# How to build a engine for profitability based on inputs that are both discrete and continuous?

Background: I am building a tool which alerts online advertisers based on the performance of their advertising campaigns. I know very little about machine learning.

Right now, my tool stores (Clicks, Profit) for my users:

• Click = how many people coming to your site
• Profit is the total value of item purchased

I am looking into building a prediction engine which will be able to answer question such as: Based the fact that it's Wednesday at 5pm, is the ratio of Profit/Click above or below expectation?

What models should I use that can take parameters such as

• Hour of the day (Discrete)
• Weekday/Weekend (boolean)
• is_holiday (boolean)

to output an expected ratio of Profit/Click?

• You appear to be describing something very close to a time-series model. – whuber Apr 17 '18 at 19:22
• I've built a tool like that. Are you open to do business? – Jim Apr 17 '18 at 19:44

There are many ways you could build this model considering it's a standard regression problem. If you want a simple, interpretable model, try a linear regression. For example,

$$profit/click = \beta_0 + \beta_1\cdot hour\_of\_day + \beta_2\cdot is\_weekday + \beta_3\cdot is\_holiday$$

This should be very easy to do in any statistical package.

There are several other good approaches for a more complex model, such as ridge regression, LASSO regression, regression trees, and support vector machine regression. It would be worth looking into ridge and LASSO if your only goal is prediction.

EDIT:

As whuber noted below, a modeling choice needs to be made with respect to the hours of day variable. It can be treated as discrete, in which case we need 23 parameters for each hour of the day (minus one for baseline). Or it can be treated as continuous (which is what the model I wrote above implies), in which case we need to ensure there is no discontinuity between hour 0 and hour 23 since we are dealing with a circular variable. There is some discussion on dealing with continuous circular variables here.

• The model you give is inconsistent with the information provided in the question. For instance, if hour of day will truly be treated as "discrete," then your $\beta_1$ needs to be replaced by a vector of $23$ parameters. But this begs the question of the appropriateness of such a modeling choice, since hour of day has much more meaning: it's a circular variable. Perhaps this isn't quite the "standard regression problem" it seems to be. – whuber Apr 17 '18 at 19:23
• Yes, that's a good point. This seems like a good discussion on the topic. – JP Trawinski Apr 17 '18 at 19:35
• From a marketing point of view I would view hour of day to be a discrete variable because traffic peaks when "people go to work around 9am" or "people have lunch around 12pm". – Hot dog Apr 17 '18 at 19:37
• @Hot That's an issue of how the response is related to time. If you insist on treating hour as discrete, you use up 23 parameters where likely only a handful are really needed when treating it as a circular variable. Unless there is a great deal of data, that lack of parsimony could lead to overfitting and/or inflated standard errors of estimate. Of greater import is the prospect of strong serial correlation among the responses at nearby times: that deserves to be considered first when deciding on a model. – whuber Apr 17 '18 at 20:23