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>
This commit is contained in:
Daniel Szemerey
2022-01-23 11:38:40 +01:00
committed by GitHub
co-authored by Daniel Szemerey Mark Aron Szulyovszky
parent 6b26643ece
commit 516c8bcc87
16 changed files with 141 additions and 154 deletions
+5 -3
View File
@@ -5,7 +5,7 @@ import pandas as pd
from models.model_map import default_feature_selector_classification, default_feature_selector_regression
from models.base import Model
from reporting.types import Reporting
from typing import Union
from typing import Union, Optional
def train_meta_labeling_model(
@@ -18,8 +18,9 @@ def train_meta_labeling_model(
data_config: dict,
model_config: dict,
training_config: dict,
model_suffix: str,
preloaded_models: Union[list[Reporting.Single_Model], None] = None
model_suffix: str,
from_index: Optional[int],
preloaded_models: Optional[list[tuple[str, pd.Series, list[pd.Series]]]] = None
) -> tuple[pd.Series, pd.Series, pd.DataFrame, list[Reporting.Single_Model]]:
discretize = discretize_threeway_threshold(0.33)
@@ -38,6 +39,7 @@ def train_meta_labeling_model(
expanding_window = training_config['expanding_window_meta_labeling'],
sliding_window_size = training_config['sliding_window_size_meta_labeling'],
retrain_every = training_config['retrain_every'],
from_index = from_index,
scaler = training_config['scaler'],
no_of_classes = 'two',
level = 'meta_labeling',