2
$\begingroup$

I have a really interesting question for you: I have data of hourly income with segments like: day of a week, department, source, etc.

enter image description here

I'm trying to build a model that looks on historical data, and can help me to understand in every time point in the day, what is the income prediction for the end of the day. So, if I want to predict at 3 AM, the prediction will use the real data from 00:00, 01:00, 02:00.

Is someone familiar with prediction method that can deal with this question? Hope I was clear enough. Tell me if not and I will clarify myself.

$\endgroup$
0
$\begingroup$

Looking at the data sample you provided, I would suggest you to replace categorical variables with dummy variables. For example, if you have n categorical values, you will have n-1 dummy variables. Coming to the Hour column of your dataset, I would suggest you first plot your income based on hours and if you see that there is a definate relationship, you can also add them to your model. One easiest way to do that, would be to divide working ours into segments and then make binary variables based on these segments. Let's say, you have 3 segments: Morning- 8-11 am, Noon - 11am -2pm and Afternoon - 2pm - 5pm. For 15:00 you would have 1 in the column Afternoon and 0 (zero) for other two columns. After doing your feature engineering, you can then move onto model building. For this particular question, I would advice you to try:

  1. 1) Decision Tree (Random Forest) - http://machinelearningmastery.com/implement-decision-tree-algorithm-scratch-python/

  2. Multiple Regression - http://machinelearningmastery.com/linear-regression-for-machine-learning/

  3. Neural Networks (for advanced level) - You can find it on the same webpage
$\endgroup$
0
$\begingroup$

I would approach your problem as a time series prediction using supervised learning. It means:

  1. Every hour I would create a feature vector from a fixed size history time window (for example past 24 hours). Features could be the income (24 times), sum of income for past 1 hour, 2 hours, etc. Differences between incomes, is a working day, is a holiday, day of the week feature, hour, etc. More about feature engineering for time series

  2. Make predictions for next 24 hours I think there are 2 ways. a) One model would give you 24 numbers b) Model would give you just the prediction for the next hour. The result can be used as input for predicting next hour.

  3. You would get income prediction for the end of the day be summing all hour income predictions (and historical incomes) for the particular day.

Another useful link and other about the time series on the same web.

$\endgroup$
0
$\begingroup$

This is a multi-variate analysis; in addition to hour, there is department , day of the week, value and more. So simple statistical analysis will not be sufficient. You could try Deep Learning

$\endgroup$
  • $\begingroup$ Can you expand on this by editing it to tell us why your suggestion is better than the ones already put forward? $\endgroup$ – mdewey Jun 20 '17 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.