# Predicting household energy consumption?

I have a fairly simple dataset of energy consumption values generated every half hour. I want to train a model to predict the energy consumption at a particular time. How do I model time values?

– Emre
May 11 '18 at 17:03
• May 11 '18 at 17:19

At first sight, the total acumulated energy consumption seems to have a linear relation with time, so I suggest to try a linear regression at first. There are several libraries you can use to code it. I recommend you do it with pandas and sklearn, here is an answer related to this: answer.

If the relation is not linear, so I could try with a more complex model (but I suggest to keep simplicity at first). Since you are trying to predict a temporal serie, I would try with an LSTM model. Here is a tutorial to implement an LSTM neural network with keras.

• The problem is not about linearity or non-linearity, if we formulate the input as the current timestep and the k-previous timesteps concatenated into one feature vector, a standard NN will have separate parameters for each input feature, so it would need to learn all of the rules of the problem separately at each position in the sequence. By comparison, a recurrent neural network shares the same weights across several time steps. May 11 '18 at 18:06
• I understand the difference between a standard and a recurrent neural network, but I think the first approach to model the problem should be the simplest. May 11 '18 at 18:14
• for any kind of classification problem the first approach to model the problem should be the simplest. his question was How do I model time values? May 11 '18 at 18:28
• @FedericoCaccia Your answer seems to be telling how do I solve this problem and which algorithm do I choose and talks about linearity. Like FadiBakoura said I am more concerned with modelling time values. The problem here is I cannot simply encode the date and time values. I am trying to encode date as - season, day of the month, month and time as values between 1 - 48. May 12 '18 at 9:27
• If you have your data in a csv for example, you can use pandas.read_csv(file, parse_dates = True, infer_datetime_format = True) May 12 '18 at 14:33

When you are a hammer, every problem looks like a nail.

This is a textbook problem in time-series analysis, and has been engaged with some decent levels of success using things like auto-regressive methods (ARIMA...) since the 1970's era.

How you handle your data depends on the nature of the data. Mileage varies. There is no silver bullet.

Here are some examples where variations of it are engaged.