Newbie question here but I was curious to ask if an MLP Neural type network can be trained on time series data?

The dataset that I have is an electricity type data set from a building power meter and I can find I can train a decent NN model with including a lot of weather data and also a lot of one hot encoding dummy variables for time-of-week. (day, hour, month number, etc.)

I am experimenting in Python with the Tensorflow Keras library and I know the default during the training process randomly shuffles the data. Is this a No-No for a time series type problem where the random shuffle will take out the seasonality from the data? (stationary/non-stationary) The results shuffling the data really aren't that bad at a glance but not-randomly shuffling the data the results for MLP NN are poor, like the model doesn't train well.

I know some other times series forecast methods can include ARIMA, LSTM, etc. but I was curious to inquire if MLP can be used for these purposes too? What I ultimately need is a short term forecast method that can incorporate hourly weather forecast (from a web API) to forecast future hourly building electricity. Any tips greatly appreciated.



2 Answers 2


So I posted this same question on machine learning mastery post about removing trends and seasonality difference transform for time series data. And Jason Brownlee responded to my questions:

Yes, you can use MLP, CNN and LSTM. It requires first converting the data to a supervised learning problem using a sliding window:


Then evaluating models in a way that respects the temporal ordering of obs, called walk-forward validation:


You can see tens of tutorials and my book on this here:



Ben February 12, 2021 at 8:09 am #

Cool thanks for all the info. So if I used multivariate sliding window for MLP NN, is Ok when training the model that shuffle_data == True? or should I not shuffle training data…? Thanks so much!


Jason Brownlee February 12, 2021 at 1:36 pm #

Yes, as long as all data in the training dataset is in the past compared to the test set.

  • $\begingroup$ shuffle_data = True should not work because shuffling would remove temporal associations of the data. $\endgroup$
    – sandyp
    Commented Apr 18, 2022 at 1:43

Consider entity embeddings for categorical features in neural networks which is necessity for tabular data on NN.

Not mine: https://www.kaggle.com/abhishek/entity-embeddings-to-handle-categories


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.