TLDR
Yes, an MLP can be used for time series forecasting. Convert the data into lagged input windows, split train and test in time order to avoid leakage, and you can still shuffle samples during training. MLPs can work well, but they rely heavily on how you design the inputs since they do not explicitly model time.
Longer answer
1) How to use an MLP for time series
You can definitely use a standard MLP for time series data. The key step is to turn the series into a supervised learning problem.
This means creating input target pairs where:
- X is a window of past values and features
- y is the value you want to predict
For example, you might use the last N hours of electricity usage, weather data, and calendar features to predict the next hour.
2) Fixed input size limitation
One constraint is that you now work with a fixed input size. The model only sees a predefined number of past steps.
This is usually fine for short term forecasting, but it does mean:
- you must choose a window size upfront
- longer-term dependencies are only captured if you explicitly include them
3) Lack of built-in temporal structure
An MLP does not inherently understand time ordering. It just sees a flat vector of features.
So even if you feed a sequence like [t-3, t-2, t-1], the model has to learn:
- which parts correspond to recent vs older values
- how to interpret temporal patterns
Models like LSTM or GRU have this structure built in, which can make them more effective in some cases.
4) Shuffling and data leakage
This is an important point.
You should always split your data in time order
Train on earlier data and test on later dataOnce you have built your lagged samples, shuffling during training is usually fine. Each sample is independent at that point
What you should avoid is mixing future data into the training set. That would introduce leakage and give overly optimistic results.
5) Feature engineering matters a lot
Since MLPs do not model time explicitly, good features are critical.
Useful features include:
- calendar features like hour of day, day of week, month
- weather variables
- lagged values such as t-1, t-24, etc.
- rolling statistics like moving averages
These help the model capture daily and seasonal patterns.