Commit Graph

58 Commits

Author SHA1 Message Date
Mark Aron Szulyovszky f762ceed2a feat(FeatureExtraction): added fractionally differentiated returns to remove lagged returns (#95)
* feat(FeatureExtraction): added fractionally differentiated returns to remove lagged returns

* fix(Sweep): config

* fix(Sweep): name

* fix(Sweep): grid

* feat(Config): separated sliding_window_size_level1 & sliding_window_size_level2

* feat(Dependencies): added ray, now using it to parallel process feature extraction

* fix(Dependencies): added pip explicitly

* fix(Dependencies): removed ray from root

* fix(Models): average model was probably not taking the right timestamp to average

* feat(Config): separated expanding_window_level1 & expanding_window_level2

* fix(Config): set n_features_to_select to the optimal 30
2021-12-28 22:50:09 +01:00
Mark Aron Szulyovszky cc70d3f907 feat(Selection): added toggleable feature selection step into the pipeline (#83)
* feat(Selection): added prototype feature selection python script

* feat(Utils): added some helpers for the future from Advances in Financial ML book

* feat(Selection): added RFECV

* feat(Selection): added configurable feature selection step into pipeline

* feat(Config): added level_1 & level_2 default config, PCA before feature selection process starts

* feat(Selection): added backup feature selector models if current one can't output feature importance, removed unnecessary array for level-2 models

* fix(Training): deal with zero first value coming out of static models

* feat(Sweep): added feature selection sweep

* fix(Sweep): config problem

* fix(Sweep): config

* chore(Utils): removed unnecessary purged k-fold crossval class

* feat(Config): added dimensionality_reduction as a separate flag

* fix(Sweep): config updated

* fix(Sweep): sweep name

* chore(Config): updated level_2 config to the best performing configuation
2021-12-27 21:59:22 +01:00
Mark Aron Szulyovszky a9b05dbd42 fix(Reporting): use weighted average (with no_of_samples as weights) and only report level-1 OR level-2 model performance (#91)
* fix(Reporting): use weighted average (with no_of_samples as weights) and only report level-1 OR level-2 model performance

* chore(Config): updated sweep config

* fix(Reporting): missing import

* fix(Evaluation): get_first_valid_return_index can deal with zero valid indexes

* fix(Training): increase threshold for skipping assets

* fix(DataLoader): target asset should be always the first column
2021-12-26 12:15:11 +01:00
Daniel Szemerey fc4e59a7d2 feat(Sweep): separated level-1 and level-2 sweep configs, skip assets with too few samples to train on, simplified model mapping (#84)
* feat: Added ensemble models to sweep and configured naming convention.

* fix: Default value was misconfigured.

* feat(Sweep): separated level-1 and level-2 sweep configs, skip assets with too few samples to train on, simplified model mapping

* fix(Sweep): syntax error

* chore(Sweep): set sweep names accordingly

* fix(Sweep): set sliding window

* fix(Sweep): adjusted sweep config

* fix(Sweep): removed invalid feature extractor preset

Co-authored-by: Mark Aron Szulyovszky <mark.szulyovszky@gmail.com>
2021-12-23 23:48:59 +01:00
Mark Aron Szulyovszky eea88103f4 feat(Metrics): added probabilistic sharpe ratio (#82)
* feat(Metrics): added probabilistic sharpe ratio

* Apply suggestions from code review
2021-12-23 17:06:22 +01:00
Mark Aron Szulyovszky 4fb1f303d7 fix(Sweep): config with constants 2021-12-23 14:13:52 +01:00
Mark Aron Szulyovszky 95573eb9dd feat(Data): add option to predict 3 classes (#79)
* feat(Data): add option to predict 3 classes

* feat(Evaluation): added ability to evaluate 3 class predictions

* chore(Config): set sensible config for regression models

* feat(Data): added option to use balanced or imbalanced three-class data

* feat(Evaluate): correctly track "no_of_samples" now that we have three classes

* chore(Sweep): remove probably not useful scaler values from sweep
2021-12-23 13:24:56 +01:00
Mark Aron Szulyovszky b6cd6b14fe feat(Config): feature extractors are enabled one-by-one with a bool, added previous model to model.fit() (#77)
* feat(Config): feature extractors are enabled one-by-one with a bool, added previous model to model.fit()

* fix(Sweep): removed unused `other_features` parameter that fails sweep

* feat(Config): using preset names for defining feature extractors again

* fix(Tests): fixed model stub classes
2021-12-23 10:35:20 +01:00
Mark Aron Szulyovszky 6ae8acf70e feat(Models): added debug_future_lookahead, sped up LogisticRegression & DecisionTreeClassifier (#74)
* feat(Models): added `debug_future_lookahead`, sped up LogisticRegression & DecisionTreeClassifier

* feat(Training): added ability to train on expanding_window

* feat(Models): tuned some hyperparameters, added expanding_window to sweep config, fixed tests

* feat(Models): tune parameters of ensemble models

* fix(Config): use window size that works with ensembling
2021-12-22 16:59:03 +01:00
Mark Aron Szulyovszky 25b64f5a3d refactor(Reporting): only report the last model's results, moved wandb-related functions to reporting (#69)
* refactor(Reporting): only report the last model's results, moved wandb-related functions to `reporting`

* fix(Reporting): use .mean() on axis 1 to retain the metrics, fixed get_model_name()

* fix(Config): sweep file syntax

* fix(Config): changed hyperparameter search method to "bayes"

* chore(Sweep): adjusted sweep config based on the results we saw (removed Momentum as well)

* fix(Sweep): only use classification method for now, we're not yet prepared for regression
2021-12-22 12:04:38 +01:00
Mark Aron Szulyovszky cfc9529274 chore(Config): added more options to sweep.yaml (#66)
* chore(Config): added more options to sweep.yaml

* fix(Config): mistake with declaring `value` <> `values` in sweep.yaml

* fix(Config): set the metric to optimize for
2021-12-21 19:23:36 +01:00
Daniel Szemerey 1c1b8b2e54 Feature: Added sweep functionality (#65)
* feat: Parametricized model selection works now.

* feat: Fixed errors. Sweep generates and you can run it, but it gives an error for model.only_columns attribute.

* feat: Factored the wandb management, default config managment and the model_dictionary out of the run_pipeline to a seperate file.

* fix: Took out prints and fixed the mismatch of ensemble models when classifing.

* fix(Models): added StaticMomentum model to the dictionary, hopefully fixed sklearn-ex RandomForestRegressor problem

* fix(Dependencies): pin scikit-learn-ex's version, moved map_model_name_to_function to `models`

* feat(Sweep): added `run_sweep.py` shortcut

* feat(Pipeline): skip training a meta model if array is empty

Co-authored-by: Mark Aron Szulyovszky <mark.szulyovszky@gmail.com>
2021-12-21 17:28:36 +01:00
Mark Aron Szulyovszky d3d7184ea4 feat(Models): added StaticAverageModel for average ensembling & StaticNaiveModel (#64)
* feat(Models): added StaticAverageModel for average ensembling

* feat(Models): made sure we only pipe in predictions to StaticAverageModel, added StaticNaiveModel as potential baseline

* chore(Models): removed unnecessary commented out code
2021-12-21 15:57:08 +01:00
Mark Aron Szulyovszky 79d84cf0a3 feat(Model): added own Model class, SkLearnModel wrapper and StaticMomentumModel (#61)
* feat(Model): added own `Model` class, SkLearnModel wrapper and StaticMomentumModel

* fix(Tests): added missing Model variable

* fix(Tests): added missing clone method()
2021-12-21 10:30:09 +01:00
Mark Aron Szulyovszky 85ad937078 refactor(Core): small refactor in the pipeline to streamline classification/regression model handling (#60) 2021-12-21 09:23:06 +01:00
Daniel Szemerey 52268d0141 feat: Added Weight and Biases single run logging. (#58)
* feat: initial wandb configured. Sweep parameters aren't configured yet.

* feat: Wandb logs now results.

* feat: gitignore.

* fix: Took out print()

* feat: Changed default value of wandb to False.

* feat: Added wandb to turn of automatically if there is no environment variable to start it (when we push it). Added environment configuration aswell.

* feat: Each assets model is seperated into a run that tracks the results.

* fix: Nonetype error, truncated assets.

* fix: Fixed the logging to wandb.
2021-12-20 17:49:11 +01:00
Mark Aron Szulyovszky 122b7bb128 feat(Evaluation): added "no_of_samples", "ratio_of_classes" metrics to aid model debugging (#56) 2021-12-20 16:38:44 +01:00
Daniel Szemerey a7414eac23 feature: Added Weights and Biases configuration to the repo. (#48)
* feat: initial wandb configured. Sweep parameters aren't configured yet.

* feat: Wandb logs now results.

* feat: gitignore.

* fix: Took out print()

* feat: Changed default value of wandb to False.

* feat: Added wandb to turn of automatically if there is no environment variable to start it (when we push it). Added environment configuration aswell.

* fix(Dependencies): the package name seems to be python-dotenv

Co-authored-by: Mark Aron Szulyovszky <mark.szulyovszky@gmail.com>
2021-12-20 14:01:14 +01:00
Mark Aron Szulyovszky 034bc1f213 fix(Training): major bug in scaling, we only scaled training data, not the ones we're predicting from (#45) 2021-12-19 13:14:14 +01:00
Mark Aron Szulyovszky b456ec3cb7 feat(Data): added feature extractors, and feature extractor presets, removed a bunch of custom arguments from load_data (#42) 2021-12-19 12:14:59 +01:00
Mark Aron Szulyovszky b8b7375c30 feat(Tests): added test for evaluate_predictions() (#41) 2021-12-18 22:23:07 +01:00
Mark Aron Szulyovszky 0963df2087 refactor(Project): move out load_data to utils, rename fetch_data to run_fetch_data, got classifiers to work (#38) 2021-12-17 17:41:50 +01:00
Mark Aron Szulyovszky cc7061b456 feat(Core): ensemble models, correct forward returns calculation, scaling, only train from when asset returns are available, major bug fixed in walk_forward_train_test (#35)
* fix(Core): correct forward returns calculation, classifiers are now working again, only train from when asset returns are available

* feat(Utils): added get_first_valid_return_index()

* feat(Ensemble): return models from `run_whole_pipeline`

* feat(Ensemble): added ensemble step, fixed walk_forward_train_test predictions index confusion,

* chore(Pipeline): remove unnecessary extra ensemble results dataframe

* refactor(Core): removed unnecessary ensemble_train_predict, moved run_single_asset_trainig_pipeline to a separate file

* feat(Training): added scaling on expanding window (the past) to walk_forward_train_test(), now printing out mean sharpe ratio

* feat(CI): added environment.yml file

* chore(Environment): update env.yml

* feat(CI): added testing workflow

* fix(CI): renamed enviroment.yml

* fix(Tests): added missing new parameter to walk_forward_train_test()
2021-12-17 14:32:17 +01:00
Mark Aron Szulyovszky 1eaba0c221 fix(Evaluate): ignore empty data at evaluation time, add backtesting metrics (sharpe, etc), fixed crash when predicting 0.0 (#23)
* fix(Evaluate): ignore empty data at evaluation time, so we don't inflate the model's performance

* refactor(Pipeline): pass in data_loader arguments to the pipeline

* feat(Evaluation): added sharpe, sortino, etc

* fix: Took out the method to fill NaN numbers with 0s. This way in evaluation we can ignore NaN values.

* fix: Fix of the fix added fillna back. Either we root out NaN lines in the very beginning or we stick with the method you created.

Co-authored-by: Daniel Szemerey <szemy2@gmail.com>
2021-12-15 21:11:12 +01:00
Mark Aron Szulyovszky 6440ced32c feat(Tests): added basic unit tests for walk_forward_train_test() (#22)
* feat(Tests): added basic unit tests for walk_forward_train_test()

* fix(Tests): inherit from BaseEstimator, fix index problems in walk_forward_train_test

* fix(WalkForward): predictions were mistakenly removed, oops

* fix(WalkForward): mistakenly re-assiging model
2021-12-15 17:54:03 +01:00
Mark Aron Szulyovszky 64721330a3 feat(Pipeline): save results, train on all assets 2021-12-14 22:59:44 +01:00
Mark Aron Szulyovszky 7a6ddcec08 fix(Data): one-hot encode date features 2021-12-14 22:58:43 +01:00
Mark Aron Szulyovszky beb281fc3a feat(Evaluation): created a unified evaluation framework for both regression / classification 2021-12-14 21:25:43 +01:00
Mark Aron Szulyovszky 1ef314c034 fix(WalkForward): major bug where we passed in "window of windows of data" is resolved, refactored walk_forward_train_test() and load_data() 2021-12-14 21:07:03 +01:00
Mark Aron Szulyovszky d047b7417e feat(WalkForward): added regression/classification switch, archived old experiments, wrapped the process into run_whole_pipeline() (#10)
* refactor(WalkForward): cleaned up training & evaluation code

* refactor: added run_whole_pipeline(), moved all previous models to archive
2021-12-14 18:16:17 +01:00
Mark Aron Szulyovszky 7aedb91069 feat(Data): added various data loading config options, walk forward method draft (#9)
* feat(Eval): added format_data_for_backtest()

* feat(Data): added many configurable parameters to load_files to reduce boilerplate and prepare for HPO

* feat(Core): added walk forward method of training/testing

* fix(Model): remove the unnecessary softmax activation from the keras models

* feat(Core): added walk_forward_train_test()
2021-12-01 09:28:24 +01:00
Daniel Szemerey d4676e099b feat(Pytorch): added custom model to pytorch-forecasting (#8)
* feat: Refractored and created new model. Pipeline not ready yet.

* feat: Implemented and refactored a data pipeline.

* ref: Refractored to make more sense.

* feat: Training works now with models that you can change.

* feat: Added predict function but without working instructions.

* feat: gitignore.
2021-11-18 10:59:06 +01:00
Mark Aron Szulyovszky 6e192ebc8a feat(Models): added a basic sktime model and missing USD crypto currency pairs (#7) 2021-11-17 22:28:34 +01:00
Mark Aron Szulyovszky 3fec439c08 feat(Data): added new derived features + asset pairs for crypto tickers (#6) 2021-11-17 12:07:49 +01:00
Daniel Szemerey b0b0d5bbba feat: Added normalizaton. 2021-11-16 10:20:35 +01:00
Mark Aron Szulyovszky 1d6eed3a94 feat(Core): added the first classification model & the feature necessary (#4)
* feat(Core): added the first classification model & the feature necessary

* feat(Models): added basic transformers model
2021-11-16 10:02:02 +01:00
Mark Aron Szulyovszky 797791d2f4 feat(Forecasting): pytorch-forecasting scaffolding is now working, added narrow data format, fixed missing time column index name (#5)
* feat: Started implementing pytorch-forecasting.

* feat(Forecasting): pytorch-forecasting scaffolding is now working, added narrow data format, fixed missing `time` column index name

Co-authored-by: Daniel Szemerey <szemy2@gmail.com>
2021-11-16 10:00:26 +01:00
Daniel Szemerey a59e705f02 Merge pull request #3 from applied-exploration/feature/feature-engineering
feat(Data): added new date-related features, and ability to train on "n days in advance" returns
2021-11-15 11:01:52 +01:00
Mark Aron Szulyovszky 07302a7541 feat(Models): added MAE & RMSE metrics, fixed NaN & Inf values in data, 2021-11-14 23:50:25 +01:00
Mark Aron Szulyovszky 3581c8db83 chore(Models): remove separate model for forecasting for 10 days in advance 2021-11-14 17:28:36 +01:00
Mark Aron Szulyovszky ead7db3a85 feat(Data): added create_target_cum_forward_returns, now using it for FF & LSTM models, with success 2021-11-14 17:25:32 +01:00
Mark Aron Szulyovszky 478a15a7cb feat(Data): added day/month/dayofweek features 2021-11-14 17:24:56 +01:00
Mark Aron Szulyovszky 9d342d6039 feat(Data): added day_month, month, day_week columns as features 2021-11-14 11:59:59 +01:00
Mark Aron Szulyovszky 1429051c4c feat(Modles): lstm model now using StandardScaler 2021-11-12 23:25:38 +01:00
Daniel Szemerey 58bef94769 Merge pull request #2 from applied-exploration/feature/10-day-projection
feat(Models): added model that predicts 10 days ahead
2021-11-12 16:42:54 +01:00
Mark Aron Szulyovszky baf7d261e8 feat(Models): added model that predicts 10 days ahead 2021-11-12 16:10:55 +01:00
Mark Aron Szulyovszky ce45288315 feat(Models): added lstm tutorial from mlmastery.com 2021-11-12 12:30:04 +01:00
Mark Aron Szulyovszky 67d830ca09 feat(Models): added simple Feed forward layer 2021-11-11 18:42:23 +01:00
Mark Aron Szulyovszky 5f8efc97fa feat(Model): now successfully training the basic LSTM model 2021-11-11 18:29:05 +01:00
Mark Aron Szulyovszky 78b3c07420 feat(Model): trying to get to a model that can train 2021-11-11 17:53:24 +01:00