Commit Graph

21 Commits

Author SHA1 Message Date
Mark Aron Szulyovszky 5c4a5b0cf1 refactor(Project): removed regression method (we can still use regression models, but we'll need map them to classification later) (#182)
* refactor(Project): removed regression method (we can still use regression models, but we'll need map them to classes later)

* fix(Training): removed mistakenly left in `method` parameter
2022-01-23 17:15:08 +01:00
Daniel Szemerey 516c8bcc87 feat(Inference): Inference now runs on the entire pipeline, only train/predict one asset, adjust trading costs (#173)
* fix, feat: Fixed inference processing data. Add transformation attribute.

* feat: Added transformations step, refractored the loop to make more sense (divided the train and inference loop).

* feat: Truncated models over time and transformations over time. Fixed some typing aswell.

* fix: Fixed a number of out of array problems.

* feat: Inference now works!

* fix(Steps): runtime error not checking for None

* fix(Steps): preloaded transformers are not optional anymore, sped up training by temporary increasing the retrain_every

* fix(CI): disable ray memory monitoring

* refactor(Inference): removed truncate_models and replaced it with filling X with NaN until inference should start

* feat(Inference): added index_from parameter

* fix(Tests): walk_forward test

* refactor(Pipeline): only predict one asset

* refactor(Inference): removed select_models step, inference code moved to run_inference.py so it matches convention (similar to run_pipeline.py)

* fix(Evaluation): adjust transaction costs

* fix(Config): adjusted retrain_every

Co-authored-by: Daniel Szemerey <szemereydaniel@gmail.com>
Co-authored-by: Mark Aron Szulyovszky <mark.szulyovszky@gmail.com>
2022-01-23 11:38:40 +01:00
Mark Aron Szulyovszky 580500a46a feat(Evaluation): adjusted transaction costs to be more realistic 0.3% (#150) 2022-01-11 12:41:02 +01:00
Mark Aron Szulyovszky 73cfc67336 fix(Evaluation): correlation test should work on a per asset level, not per model level (#142)
* fix(Evaluation): correlation test should work on a per asset level, not per model level

* fix(Evaluation): correlations series initalized correctly

* fix(Reporting): don't name the run after the incorrectly supposed model_type

* fix(Reporting): put back send_report_to_wandb() into its original place

* fix(CI): sending reports again in comment
2022-01-10 14:17:06 +01:00
Mark Aron Szulyovszky b1c04afb13 refactor(Naming): use new convention, added Ensemble model parameter back, support multiple Meta-Labeling models (#132)
* refactor(Naming): use `primary_models` & `meta_labeling_models`

* refactor(Naming): using primary * meta_labeling across config and in pipeline

* feat(Pipeline): added back Ensemble models

* fix(Pipeline): compiler error

* fix(Config): typo

* chore(Pipeline): removed unused averaging step

* revert the changes in discretizing

* chore(Pipeline): remove sharpe improvement logging

* fix(Pipeline): ensemble predictions should be a pd.Series instead of a DataFrame

* fix(Pipeline): discard unnecessary ensemble_probabilities

* fix(Pipeline): fixes regarding various meta-labeling ensemble bugs

* fix(Reporting): use the new naming convention

* fix(Reporting): use the right variable

* feat(Sweep): new sweep for ensemble models

* fix(Sweep): config reference

* fix(Config): simplified dev config

* fix(Models): use the faster LR model

* fix(Models): use LGBM in the meta-labeling model for speed

* fix(Selection): always use the first model for feature selection, commented out caching from select_features() as it's close to redundant in terms of speed
2022-01-09 17:21:06 +01:00
Mark Aron Szulyovszky 22b3167cb9 feat(Evaluate): increase transactions costs, to get a more realistic view on performance (#137) 2022-01-09 14:18:20 +01:00
Mark Aron Szulyovszky 34105f7ca1 feat(Evaluation): added minimal transaction costs to penalize higher turnover (#125) 2022-01-07 18:27:24 +01:00
Mark Aron Szulyovszky 9488e92597 feature(MetaLabeling): replaced previous non-functional Ensembling method with Meta-labeling method available for both lvl1 and lvl2 models (#110)
* feature(MetaLabeling): added hacky prototype

* fix(MetaLabeling): drop index until first valid X & y

* fix(MetaLabeling): transform both X & y before feature selection

* fix(MetaLabeling): got feature selection to work

* fix(MetaLabeling): correct values for meta_y

* feat(MetaLabeling): created predictions multiplied by bet sizes

* feat(Pipeline): print out averaged result

* fix(Evaluation): correctly deal with non-discretized data

* fix(Pipeline): use the right column names

* refactor(Pipeline): move out meta-labeling

* refactor(Pipeline): complete refactoring

* feat(CI): post results to PR

* fix(Pipeline): use the correct filename

* chore(Config): removed now redundant feature_selection flag

* feat(Models): added SVC

* fix(Pipeline): accidentally switched two return values

* feat(Sweep): prepared sweep_meta.yaml, moved report_results() into a separate file

* fix(Pipeline): wrong function name

* fix(Sweep): yaml + run_sweep

* fix(Sweep): typo in name

* fix(Reporting): only save averaged results

* feat(MetaLabeling): use optional meta-labeling step for every lvl1 models, before averaging

* feat(Reporting): print out sharpe improvement in meta-labeling step

* fix(Sweep): adjusted config, defaulted to good defaults

* fix(Sweep): adjusted sweep
2022-01-06 16:36:45 +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 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 122b7bb128 feat(Evaluation): added "no_of_samples", "ratio_of_classes" metrics to aid model debugging (#56) 2021-12-20 16:38:44 +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 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
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 07302a7541 feat(Models): added MAE & RMSE metrics, fixed NaN & Inf values in data, 2021-11-14 23:50:25 +01:00