2
$\begingroup$

I am wokring on a regression model (random forest in this case) that predicts energy consumption in X hours ahead.

The trained model gets as an input historical energy consumption. Which it uses to calculate certain features (e.g. lag energy, consumption in similar hours, etc) and then estimates energy consumption in the next hour.

The estimated consumption would be then be added to the historical data to estimate the consumption in the following hour and so on.

My problem is that it seems for the first few hours, the estimated consumption value is the same. And it only starts to diverge after a while.

This happens even though the features are actually changing in each iteration. Below is an example of feature values and their corresponding model output

Is this behaviour normal?

If not what are the typical mistakes that could lead to this issue?

index f1 f2 f3 f4 f5 f6 f7 f8 Model output
0 772.58 2826.54 324.67 1581.91 1.00 1.00 0.00 51.00 691.68
1 509.97 2847.04 691.68 1533.58 1.00 1.00 1.00 51.00 691.68
2 569.34 2866.52 691.68 1544.21 1.00 1.00 2.00 51.00 691.68
3 691.68 2885.35 691.68 1504.43 1.00 1.00 3.00 51.00 691.68
4 691.68 2902.96 691.68 1540.28 1.00 1.00 4.00 51.00 701.68
$\endgroup$

1 Answer 1

2
$\begingroup$

Random forests are built from decision trees, which partition the data into discrete groups and assign a predicted value to each group. Because of that the predictions will never be a continuous function of your inputs (although with lots of trees, you might be able to get something that is effectively continuous).

Your output is consistent with all trees in your model splitting on f7 > 3.5, for example. Also it's noticeable that the model output is exactly equal to the f3 values for a lot of rows, which I am guessing is the lagged target. My guess is that these rows were used for training, and the model learned some rule like "When f7 < 4, the output is 691.68".

If you need to get a prediction from a random forest that varies continuously with some variable, you might want to try using a ratio of your current output and that variable as the target. For example instead of predicting total energy usage, predict this hour's energy use as a percentage of the last hour's energy use.

However I think you probably would have better luck using something other than a random forest for your problem.

$\endgroup$
2
  • $\begingroup$ "predict this hour's energy use as a percentage of the last hour's energy use" ... I am not sure I understand this part. Does this mean adding a feature that represent the change (in percentage) between the target hour consumption and the previous hour consumption? ... If so wouldn't I be leaking the label indirectly to my model? $\endgroup$
    – A.Shoman
    Commented Aug 12, 2021 at 6:33
  • $\begingroup$ I meant you should change the target of your model $\endgroup$ Commented Aug 12, 2021 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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