diff --git a/gamestonk_terminal/prediction_techniques/FUNE-TUNING-NN-models.md b/gamestonk_terminal/prediction_techniques/FUNE-TUNING-NN-models.md index 3e6ffb67384..2468e6f8c43 100644 --- a/gamestonk_terminal/prediction_techniques/FUNE-TUNING-NN-models.md +++ b/gamestonk_terminal/prediction_techniques/FUNE-TUNING-NN-models.md @@ -35,8 +35,9 @@ To try "backtesting" to a certain data, you can specify the end date. This will Decide whether you want to pre-process your share price data or not. I.e. do you want to use these values between 18 and 245, or perhaps normalize these between 0 and 1? The later may improve performance. ``` --p/--pp : pre-processing data. Default minmax. +Preprocess = "minmax" ``` +This is defined in the config file. 5. **Select input, prediction days and jumps in training data** @@ -54,13 +55,6 @@ Personally, I recommend to set this for a really short window. This is because t -d/--days : prediciton days. Default 5. ``` -The **jumps in the training data** corresponds to the number of days we want to jump between training loops. - -Let's say we start training our Neural Network from 2021-01-04, with 10 inputs (days) and 5 prediction days. If jump is set to 1, it means that the after optimizing our model for input data from 2021-01-04 to 2021-01-15, and predicting from 2021-01-18 to 2021-01-22, we will optimize the model for input data from 2021-01-05 to 2021-01-18, and predicting from 2021-01-19 to 2021-01-25. On the other hand, if we set the jump to 5, it means that we are identifying a "weekly" frequency in the data, and therefore, our next model optimization would use input data from 2021-01-11 to 2021-01-22, and predicting from 2021-01-25 to 2021-01-29. -``` --j/--jumps : number of jumps in training data. Default 1. -``` - 6. **Select NN architecture.** TL;DR: LSTM > RNN > MLP **MLP**: The neurons don't have any memory. @@ -98,8 +92,9 @@ This model is set in [config_neural_network_models.py](/config_neural_network_mo **Loss function**: Often chosen having the activation functions of the hidden layers in mind. See https://machinelearningmastery.com/how-to-choose-loss-functions-when-training-deep-learning-neural-networks/, and https://www.tensorflow.org/api_docs/python/tf/keras/losses. ``` --l/--loss : loss function. Default mae. +Loss = "mae" ``` +This is defined in the config file. **Optimizer technique**:Adaptive Moment Estimation (_adam_) is usually the default choice for this type of problems. See https://www.tensorflow.org/api_docs/python/tf/keras/optimizers. diff --git a/gamestonk_terminal/prediction_techniques/README.md b/gamestonk_terminal/prediction_techniques/README.md index cd4ddda2b02..cf73839b70a 100644 --- a/gamestonk_terminal/prediction_techniques/README.md +++ b/gamestonk_terminal/prediction_techniques/README.md @@ -43,19 +43,18 @@ Exponential Smoothing (based on trend+seasonality, see https://otexts.com/fpp2/t * -t : trend component: N: None, A: Additive, Ad: Additive Damped. Default N. * -s : seasonality component: N: None, A: Additive, M: Multiplicative. Default N. * -p : seasonal periods. Default 5. - * -d : prediciton days. Default 5. + * -d : prediction days. Default 5. * -e : end date (format YYYY-MM-DD) of the stock - Backtesting. Default None. ![ets_pltr](https://user-images.githubusercontent.com/25267873/110266847-97a6d280-7fb6-11eb-997e-0b598abc713b.png) ## knn ``` -usage: knn [-i N_INPUTS] [-d N_DAYS] [-j N_JUMPS] [-n N_NEIGHBORS] +usage: knn [-i N_INPUTS] [-d N_DAYS] [-n N_NEIGHBORS] ``` k-Nearest Neighbors: * -i : number of days to use for prediction. Default 40. - * -d : prediciton days. Default 5. - * -j : number of jumps in training data. Default 1. + * -d : prediction days. Default 5. * -n : number of neighbors to use on the algorithm. Default 20. * -e : end date (format YYYY-MM-DD) of the stock - Backtesting. Default None. @@ -63,51 +62,47 @@ k-Nearest Neighbors: ## linear ``` -usage: linear [-i N_INPUTS] [-d N_DAYS] [-j N_JUMPS] -usage: regression -p 1 [-i N_INPUTS] [-d N_DAYS] [-j N_JUMPS] +usage: linear [-i N_INPUTS] [-d N_DAYS] +usage: regression -p 1 [-i N_INPUTS] [-d N_DAYS] ``` Linear Regression (p=1): * -i : number of days to use for prediction. Default 40. - * -d : prediciton days. Default 5. - * -j : number of jumps in training data. Default 1. + * -d : prediction days. Default 5. * -e : end date (format YYYY-MM-DD) of the stock - Backtesting. Default None. ![linear](https://user-images.githubusercontent.com/25267873/108604948-d3cc1780-73a8-11eb-860f-49274a34038b.png) ## quadratic ``` -usage: quadratic [-i N_INPUTS] [-d N_DAYS] [-j N_JUMPS] -usage: regression -p 2 [-i N_INPUTS] [-d N_DAYS] [-j N_JUMPS] +usage: quadratic [-i N_INPUTS] [-d N_DAYS] +usage: regression -p 2 [-i N_INPUTS] [-d N_DAYS] ``` Quadratic Regression (p=2): * -i : number of days to use for prediction. Default 40. - * -d : prediciton days. Default 5. - * -j : number of jumps in training data. Default 1. + * -d : prediction days. Default 5. * -e : end date (format YYYY-MM-DD) of the stock - Backtesting. Default None. ![quadratic](https://user-images.githubusercontent.com/25267873/108604935-cca50980-73a8-11eb-9af1-bba807203cc6.png) ## cubic ``` -usage: cubic [-i N_INPUTS] [-d N_DAYS] [-j N_JUMPS] -usage: regression -p 3 [-i N_INPUTS] [-d N_DAYS] [-j N_JUMPS] +usage: cubic [-i N_INPUTS] [-d N_DAYS] +usage: regression -p 3 [-i N_INPUTS] [-d N_DAYS] ``` Cubic Regression (p=3): * -i : number of days to use for prediction. Default 40. - * -d : prediciton days. Default 5. - * -j : number of jumps in training data. Default 1. + * -d : prediction days. Default 5. * -e : end date (format YYYY-MM-DD) of the stock - Backtesting. Default None. ![cubic](https://user-images.githubusercontent.com/25267873/108604941-d169bd80-73a8-11eb-9220-84a7013e1283.png) ## regression ``` -usage: regression -p N_POLYNOMIAL [-i N_INPUTS] [-d N_DAYS] [-j N_JUMPS] +usage: regression -p N_POLYNOMIAL [-i N_INPUTS] [-d N_DAYS] ``` Regression: * -i : number of days to use for prediction. Default 40. - * -d : prediciton days. Default 5. - * -j : number of jumps in training data. Default 1. + * -d : prediction days. Default 5. * -p : polynomial associated with regression. Required. * -e : end date (format YYYY-MM-DD) of the stock - Backtesting. Default None. @@ -135,24 +130,21 @@ Auto-Regressive Integrated Moving Average: usage: fbprophet [-d N_DAYS] ``` Facebook's Prophet: - * -d : prediciton days. Default 5. + * -d : prediction days. Default 5. * -e : end date (format YYYY-MM-DD) of the stock - Backtesting. Default None. ![prophet](https://user-images.githubusercontent.com/25267873/108604938-cf9ffa00-73a8-11eb-973b-0affb343e2f6.png) ## mlp ``` -usage: mlp [-d N_DAYS] [-i N_INPUTS] [-j N_JUMPS] [--epochs N_EPOCHS] [-p {minmax, normalization,standardization,none}] - [-l {mae,mape,mse,msle}] [-e S_END_DATE] [--loops N_LOOPS] [-v VALID] [--lr LEARNING_RATE] [--no_shuffle] +usage: mlp [-d N_DAYS] [-i N_INPUTS] [--epochs N_EPOCHS] [-e S_END_DATE] [--loops N_LOOPS] [-v VALID] + [--lr LEARNING_RATE] [--no_shuffle] ``` MulitLayer Perceptron: * -d : prediciton days. Default 5. * -i : number of days to use for prediction. Default 40. - * -j : number of jumps in training data. Default 1. * --epochs : number of training epochs. Default 200. - * -p : pre-processing data. Default minmax. * -v : validation split. Default 0.1 - * -l : loss function. Default mae. * -e : end date (format YYYY-MM-DD) of the stock - Backtesting. Default None. * --xla_cpu: if present, will enable XLA for CPU (overrides environment variables during run). * --xla_gpu: if present, will enable XLA for GPU (overrides environment variables during run). @@ -181,17 +173,14 @@ MultiLayer_Perceptron \ ## rnn ``` -usage: rnn [-d N_DAYS] [-i N_INPUTS] [-j N_JUMPS] [--epochs N_EPOCHS] [-p {normalization,standardization,none}] +usage: rnn [-d N_DAYS] [-i N_INPUTS] [--epochs N_EPOCHS] [-p {normalization,standardization,none}] [-l {mae,mape,mse,msle}] [-e S_END_DATE] [--loops N_LOOPS] [-v VALID] [--lr LEARNING_RATE] [--no_shuffle] ``` Recurrent Neural Network: * -d : prediciton days. Default 5. * -i : number of days to use for prediction. Default 40. - * -j : number of jumps in training data. Default 1. * --epochs : number of training epochs. Default 200. - * -p : pre-processing data. Default normalization. * -v : validation split. Default 0.1 - * -l : loss function. Default mae. * -e : end date (format YYYY-MM-DD) of the stock - Backtesting. Default None. * --xla_cpu: if present, will enable XLA for CPU (overrides environment variables during run). * --xla_gpu: if present, will enable XLA for GPU (overrides environment variables during run). @@ -227,17 +216,14 @@ Recurrent_Neural_Network \ ## lstm ``` -usage: lstm [-d N_DAYS] [-i N_INPUTS] [-j N_JUMPS] [--epochs N_EPOCHS] [-p {normalization,standardization,none}] - [-l {mae,mape,mse,msle}] [-e S_END_DATE] [--loops N_LOOPS] [-v VALID] [--lr LEARNING_RATE] [--no_shuffle] +usage: lstm [-d N_DAYS] [-i N_INPUTS] [--epochs N_EPOCHS] [-e S_END_DATE] [--loops N_LOOPS] [-v VALID] + [--lr LEARNING_RATE] [--no_shuffle] ``` Long-Short Term Memory: - * -d : prediciton days. Default 5. + * -d : prediction days. Default 5. * -i : number of days to use for prediction. Default 40. - * -j : number of jumps in training data. Default 1. * --epochs : number of training epochs. Default 200. - * -p : pre-processing data. Default normalization. * -v : validation split. Default 0.1 - * -l : loss function. Default mae. * -e : end date (format YYYY-MM-DD) of the stock - Backtesting. Default None. * --xla_cpu: if present, will enable XLA for CPU (overrides environment variables during run). * --xla_gpu: if present, will enable XLA for GPU (overrides environment variables during run). @@ -270,17 +256,14 @@ Long_Short_Term_Memory \ ## conv1d ``` -usage: lstm [-d N_DAYS] [-i N_INPUTS] [-j N_JUMPS] [--epochs N_EPOCHS] [-p {normalization,standardization,minmax,none}] - [-l {mae,mape,mse,msle}] [-e S_END_DATE] [--loops N_LOOPS] [-v VALID] [--lr LEARNING_RATE] [--no_shuffle] +usage: lstm [-d N_DAYS] [-i N_INPUTS] [--epochs N_EPOCHS] [-e S_END_DATE] [--loops N_LOOPS] [-v VALID] +[--lr LEARNING_RATE] [--no_shuffle] ``` 1D Convolutional Neural Net: * -d : prediction days. Default 5. * -i : number of days to use for prediction. Default 40. - * -j : number of jumps in training data. Default 1. * --epochs : number of training epochs. Default 50. - * -p : pre-processing data. Default minmax. * -v : validation split. Default 0.1 - * -l : loss function. Default mae. * -e : end date (format YYYY-MM-DD) of the stock - Backtesting. Default None. * --xla_cpu: if present, will enable XLA for CPU (overrides environment variables during run). * --xla_gpu: if present, will enable XLA for GPU (overrides environment variables during run).