Recommendations on time-series price prediction models?

I would standardize, rather than normalize, each input independently.
If you decide to go with multiple outputs, I would also standardize those independently before processing; then inverse the standardization to obtain the proper forecasted values.

Got it, that makes sense! By standardizing each input independently, you mean each dimension right? If I have OHLCV data, does it make sense to standardize the OHLC data together and the V data separately?
 
Got it, that makes sense! By standardizing each input independently, you mean each dimension right? If I have OHLCV data, does it make sense to standardize the OHLC data together and the V data separately?
If those are your only inputs, then yes, you could do OHLC together, or separately. (Yes, by 'input,' I mean dimension.) And I would definitely do V separately, in either case.
 
Hey Phil, I tried to replicate the parabolic + cosines method you outlined. However I got stuck on the GA step and wonder if you can give me any help. I'm using python's geneticalgorithm package (https://pypi.org/project/geneticalgorithm/) and the results (after 1 hour) is much worse than the results you got. I attached a comparison.

I thought that this is a plain nonconvex optimization problem and using default parameters and a commonly available package like geneticalgorithm would be able to crack it easily. After reading a few of your others posts, I realizes that you are probably using a hand tuned GA solver. I wonder what kind of tweaks or knowledge do you think is essential to add to the solver in order to fit it nicely?

Yes I did, I was debating whether I should normalize it to normal distribution or something else.
Eventually I did:

Xmean = mean from input X
X = (X - Xmean) / Xmean
output Y = (Y - Xmean) / Xmean

so everything is normalized to the mean of the input data. But I'm not sure if this is the best way to normalize it.

Got it, that makes sense! By standardizing each input independently, you mean each dimension right? If I have OHLCV data, does it make sense to standardize the OHLC data together and the V data separately?

For my program, I used the raw, unprocessed data from column 7 of inputData.csv in
https://www.elitetrader.com/et/thre...-prediction-models.357511/page-3#post-5368622
I didn't want to normalize or standardize the data because I wanted to fit the actual data. And I've never found volume too useful for machine learning problems because it varies too much.

My x values were offsets in number of days from the input data (0 through 88 for the data I posted for fitting; > 88 for predicting the future).

It's possible your genetic optimization for function minimization implementation
  • Trained with too few or too many generations.
  • Had a too small or too large population size.
  • Used a crossover that mixed data of different types (e.g., y intercept of a parabola and frequency of a cosine wave probably shouldn't be crossed over).
  • Initialized and/or mutated parameter values that had no chance of helping (e.g., using a value of 123456789 when the input data was orders of magnitude away from that).
  • Used a pseudorandom number generator that wasn't very random or had too short a period. I use WELLRNG44497 (ported from http://www.ritsumei.ac.jp/~harase/WELL44497a_new.c).

Another thing that could help is using a larger input data size. I've been using 123 calendar days instead of the 89 I posted in this thread because the results seem more consistent among different runs on assorted assets.

Regarding other function minimizers/sinusoid fitters, I tried
None of these worked that well for me, because they would sometimes not be able to find a good solution (or sometimes any solution at all).

So then I tried function minimization by genetic optimization and later linear genetic programming. I currently use the genetic optimization method because my genetic programming implementation produced about the same results but ran slower.
 
Got it, thanks a lot for the thorough reply!

For my program, I used the raw, unprocessed data from column 7 of inputData.csv in
https://www.elitetrader.com/et/thre...-prediction-models.357511/page-3#post-5368622
I didn't want to normalize or standardize the data because I wanted to fit the actual data. And I've never found volume too useful for machine learning problems because it varies too much.

My x values were offsets in number of days from the input data (0 through 88 for the data I posted for fitting; > 88 for predicting the future).

It's possible your genetic optimization for function minimization implementation
  • Trained with too few or too many generations.
  • Had a too small or too large population size.
  • Used a crossover that mixed data of different types (e.g., y intercept of a parabola and frequency of a cosine wave probably shouldn't be crossed over).
  • Initialized and/or mutated parameter values that had no chance of helping (e.g., using a value of 123456789 when the input data was orders of magnitude away from that).
  • Used a pseudorandom number generator that wasn't very random or had too short a period. I use WELLRNG44497 (ported from http://www.ritsumei.ac.jp/~harase/WELL44497a_new.c).

Another thing that could help is using a larger input data size. I've been using 123 calendar days instead of the 89 I posted in this thread because the results seem more consistent among different runs on assorted assets.

Regarding other function minimizers/sinusoid fitters, I tried
None of these worked that well for me, because they would sometimes not be able to find a good solution (or sometimes any solution at all).

So then I tried function minimization by genetic optimization and later linear genetic programming. I currently use the genetic optimization method because my genetic programming implementation produced about the same results but ran slower.
 
Got it, thanks a lot! Let me try this one.

By the way, I went through the post and confirm that it predicts one day ahead. It uses the last 60 days of data to predict the next day:

Code:
for i in range(60, 1482):
    X_train.append(training_set_scaled[i-60:i, 0])
    y_train.append(training_set_scaled[i, 0])
 
By the way, I went through the post and confirm that it predicts one day ahead. It uses the last 60 days of data to predict the next day:

Code:
for i in range(60, 1482):
    X_train.append(training_set_scaled[i-60:i, 0])
    y_train.append(training_set_scaled[i, 0])

Here is an article that has examples of multi-step LSTM forecasting.
https://machinelearningmastery.com/how-to-develop-lstm-models-for-time-series-forecasting/
A time series forecasting problem that requires a prediction of multiple time steps into the future can be referred to as multi-step time series forecasting.

Specifically, these are problems where the forecast horizon or interval is more than one time step.

There are two main types of LSTM models that can be used for multi-step forecasting; they are:
  1. Vector Output Model
  2. Encoder-Decoder Model
...

And another by the same author that mentions other ways to do multi-step forecasting.
https://machinelearningmastery.com/multi-step-time-series-forecasting/
4 Strategies for Multi-Step Time Series Forecasting

1. Direct Multi-step Forecast Strategy
2. Recursive Multi-step Forecast
3. Direct-Recursive Hybrid Strategies
4. Multiple Output Strategy

His book could be helpful too.
https://machinelearningmastery.com/introduction-to-time-series-forecasting-with-python/
Introduction to Time Series Forecasting With Python
Discover How to Prepare Data and Develop Models to Predict the Future
$37 USD
 
This might be one.
https://analyticsindiamag.com/hands...t-neural-network-for-stock-market-prediction/

View attachment 257077

I am illiterate in Python, so I can't tell how long "a few days" is. This line
Code:
X_test = np.reshape(X_test, (X_test.shape[0], X_test.shape[1], 1))
makes me think few == 1.

This is pretty bad. Sanity test: if the predictions look like the original data shift back some time your just using the previous price as your prediction for the next price. which is basically modelling it as a stochastic process with no useful signal...
 
45bfb0ce-c41a-11eb-b0c2-606eecf395cb_image_hires_130301.jpg
 
Back
Top