# Best approach for energy demand forecasting

I am trying to predict the amount of energy demand(Wh) of the next two weeks per hour. The dataset I have, contains each hour of each day since 2019 of the energy demand, is something like this:

X = [[[day],[month],[year],[hour],[consumption]],
[[05], [01],  [2018],[10],  [150000]],
[[05], [01,   [2018],[11],  [153000]],
...till today]


The thing is that I have fed this dataset (after preprocessing) to a MLP(dense fully connected layers) and it seem to give good results in the validation set, but this validation set is formed by a sample of the X dataset, so it is likely that the training set has the information of the demand of the hour before and after of every one in the validation set, which would be something like cheating since from one hour to next one there are little changes in demand, and because the real case is that I would like to have a model which can predict one/two weeks further in time the energy demand per hour. I have thought that maybe there is a kind of way to fit a model only using, when predicting a given hour' demand, the subset of the training set that is two weeks or more before on time that the given hour. This is what I have thought but I don't know if it is possible or if there are other approaches better than this one. What do you think?

You should split the time series instead of using a subsample as a test set, to avoid the problem you mentioned. You can find more here: https://stats.stackexchange.com/users/205266/wind.

Also regarding your problem, I think the energy demand has cyclic features. I suggest you take a look at the book "Introduction to Machine Learning with Python" by Andreas C. Müller and Sarah Guido (ed. O'Reilly). Look for Figure 4-12 "Number of bike rentals over time for a selected Citi Bike station" and the text there, I think they solve in a nice way the very same problem you are trying to solve.