## Predicting household energy consumption?

4

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?

3Read about "time series forecasting". – Emre – 2018-05-11T17:03:22.767

– Fadi Bakoura – 2018-05-11T17:19:47.370

## Answers

1

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. – Fadi Bakoura – 2018-05-11T18:06:36.830

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. – Federico Caccia – 2018-05-11T18:14:19.190

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? – Fadi Bakoura – 2018-05-11T18:28:27.630

@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. – amitection – 2018-05-12T09:27:35.217

@amitection so If I understand, your problem is how to properly load the time data. So you should use pandas parser. How do you store your data? – Federico Caccia – 2018-05-12T14:27:01.267

1If you have your data in a csv for example, you can use pandas.read_csv(file, parse_dates = True, infer_datetime_format = True) – Federico Caccia – 2018-05-12T14:33:22.947

@FedericoCaccia No No. I know how to load the data. I have done ML before but never worked with time series data. My concern is how do I handle date time values. For obvious reason I suppose I cant use them directly. But as Emre suggested in one of the comments I am reading about time series forecasting from here https://www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/

– amitection – 2018-05-12T16:25:55.417

Ok, that article seems to be great! – Federico Caccia – 2018-05-12T16:39:57.370

1

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.