Some guys, decided to make some money, by selling lemonade in different public places. Each guy has a fix spot on which she sell the lemonade. In every morning, they go to a lemonade maker warehouse and buy the stock for the entire day, based on their forecasts. At any moment of the day, they can ask for an instant delivery, which will cost more and we don't wana this to happen. Also, if they are buying more than it was needed for that day, they will make smaller profit.

The thing is that every guy knows the places of their business. They begin to see patterns in customers habits, the consume based the day of the week, the weather, the events from the area, etc. All of those variables, the forecasts and real consumptions data are stored in a database.

Better formulations of the problem are welcome.

My wish is to implement a software approach which will help lemonade sellers for a better forecast their lemonade needs. Do you have any idea about which machine learning method can help me in forecasting lemonade sellers needs?

• What data do you have or could you collect? Commented Dec 15, 2011 at 15:57
• @MichaelMcGowan: each use records the schedule of the consumers , their names, their habits(is they come to the area in weekend or not, etc). Lemonade thing is just a scenario. I know that I have to learn a lot about statistics, but I'm not sure where to start from. Commented Dec 15, 2011 at 20:06

## Straightforward approach

This is a kind of regression problem, where you need to predict numerical value. However, simple linear regression is not applicable, since not all of your features are numerical (whether, day of week, etc.). It is impossible to make them numerical (you can't assign number 1 to Monday and number 2 to Tuesday, because Tuesday is not Monday + 1, but rather another independent day). So you need to first split your data into several parts based on categorical features (like day of week) and then apply linear regression to each part. MD5' algorithm does exactly this - it first builds decision tree and then assign distinct regression model to each leave.

## More intelligent analysis

However, previous approach doesn't concern details of the problem itself, including consumer details. More intelligent analysis includes detailed view of each available feature and extraction of more features (which may be combinations of other features - see polynomial regression). If you have not very big number of consumers, you may predict probability of selling for each particular user and then just count those, who will likely buy lemonade on particular day. If you have lots of users, use clustering to perform market segmentation and learn probabilities or regression models for each segment.

Also try to properly categorize local event types, count their participants, compute distance from selling point, etc. Just learn your features and build appropriate model.

• The first paragraph suggests you might not have heard of dummy (indicator) variables. Characterizing this as regression is problematic--it seems more like a stochastic optimization problem to me--but if you insist on doing so, you don't have to split the data according to the categorical regressors (which would lose a tremendous amount of power).
– whuber
Commented Dec 15, 2011 at 23:05
• @whuber: it seems to me quite unnatural to use indicator variables for such things as days of week, but yes, you are right - it is possible to create separate indicator feature for, say, each day of week and omit splitting data. However, such algos as MD5' normally improve results, not worsen, so it may be not bad idea to split the data. Concerning stochastic optimization. I'm not statistician, but isn't stochastic optimization problem analogous to cost function minimization in regression? You just create model and try to optimize it with respect to given data. Or am I missing something?. Commented Dec 15, 2011 at 23:53
• See stats.stackexchange.com/questions/373890/… and search this site for many similar posts Commented Aug 24, 2023 at 1:20