feat(HPO): added run_hpo script (#237)

* feat(HPO): added `run_hpo` script

* fix(Linter): ran

* feat(HPO): removed any reference to sweep (superseeded by optuna)

* fix(HPO): optimize for sharpe

* fix(Config): removed glassnode data, save trials from hpo

* feat(Labelling): added three-balanced method works again

* fix(BetSizing): set the correct class labels

* fix(HPO): powerset should return what's expected, added two new normalization methods

* fix(Linter): ran

* fix(DataLoader): sort the dataframe when fetching data

* fix(Config): only take z-score of other assets
This commit is contained in:
Mark Aron Szulyovszky
2022-03-15 14:43:16 +01:00
committed by GitHub
parent 345b48a67c
commit b5ddee8dce
30 changed files with 126 additions and 115 deletions
+6 -4
View File
@@ -1,4 +1,3 @@
from sklearn.model_selection import TimeSeriesSplit
from .types import Config, RawConfig
from utils.helpers import flatten
from feature_extractors.feature_extractor_presets import (
@@ -114,9 +113,12 @@ def __preprocess_data_collections_config(data_dict: dict) -> dict:
return data_dict
def __preprocess_event_filter_config(data_dict: dict) -> dict:
data_dict["event_filter"] = eventfilters_map[data_dict["event_filter"]]
return data_dict
def __preprocess_event_filter_config(config_dict: dict) -> dict:
config_dict["event_filter"] = eventfilters_map[config_dict["event_filter"]](
config_dict["event_filter_multiplier"]
)
config_dict.pop("event_filter_multiplier")
return config_dict
def __preprocess_event_labeller_config(config_dict: dict) -> dict:
+4 -3
View File
@@ -1,4 +1,4 @@
from .types import RawConfig, Config
from .types import RawConfig
def get_default_config() -> RawConfig:
@@ -22,14 +22,15 @@ def get_default_config() -> RawConfig:
assets=["fivemin_crypto"],
target_asset="BTCUSDT",
other_assets=[],
exogenous_data=["daily_glassnode"],
exogenous_data=[],
load_non_target_asset=True,
own_features=["level_2"],
other_features=["z_score"],
exogenous_features=["z_score"],
exogenous_features=[],
directional_models=classification_models,
meta_models=meta_models,
event_filter="cusum_vol",
event_filter_multiplier=3.5,
remove_overlapping_events=False,
labeling="two_class",
forecasting_horizon=10,
-44
View File
@@ -1,44 +0,0 @@
program: run_sweep.py
method: grid
project: price-forecasting
name: Meta labelling
metric:
goal: maximize
name: sharpe
parameters:
assets:
value: ['daily_crypto']
other_assets:
value: ['daily_etf']
exogenous_data:
value: ['daily_glassnode']
initial_window_size:
value: 380
distribution: categorical
n_features_to_select:
values: [40, 50, 60]
distribution: categorical
dimensionality_reduction_ratio:
value: 0.5
retrain_every:
value: 20
scaler:
value: 'minmax'
no_of_classes:
value: 'two'
load_non_target_asset:
value: True
directional_models:
distribution: categorical
values:
- ["LDA", "LogisticRegression_two_class", "KNN", "SVC", "CART", "NB", "AB", "RFC", "XGB_two_class", "LGBM", "StaticMom"]
- ["LogisticRegression_two_class", "LDA", "NB", "RFC", "XGB_two_class", "LGBM", "StaticMom"]
- ["LogisticRegression_two_class", "LDA", "LGBM", "RFC", "XGB_two_class"]
meta_models:
value: ["LGBM", "LogisticRegression_two_class"]
own_features:
value: ['date_days', 'level_2', 'lags_up_to_5']
other_features:
value: ['level_2', 'lags_up_to_5']
exogenous_features:
value: ['z_score']
+1
View File
@@ -26,6 +26,7 @@ class RawConfig(BaseModel):
other_features: list[str]
exogenous_features: list[str]
event_filter: Literal["none", "cusum_vol", "cusum_fixed"]
event_filter_multiplier: float
remove_overlapping_events: bool
labeling: Literal["two_class", "three_class_balanced", "three_class_imbalanced"]
forecasting_horizon: int