Files
drift/config.py
T
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

57 lines
2.3 KiB
Python

from collections import defaultdict
from utils.load_data import get_crypto_assets
from feature_extractors.feature_extractor_presets import presets
from models.model_map import model_names_classification, model_names_regression
def get_default_config() -> tuple[dict, dict, dict]:
training_config = dict(
expanding_window = False,
sliding_window_size = 220,
retrain_every = 20,
scaler = 'minmax', # 'normalize' 'minmax' 'standardize' 'none'
include_original_data_in_ensemble = True,
)
data_config = dict(
path='data/',
all_assets = get_crypto_assets('data/'),
load_other_assets= False,
log_returns= True,
forecasting_horizon = 1,
own_features = ['level_1', 'date_days'],
other_features = [],
index_column= 'int',
method= 'classification',
no_of_classes= 'two'
)
regression_models = ["Lasso", "KNN", "RF"]
regression_ensemble_models = ['KNN']
classification_models = ["LR", "LDA", "KNN", "CART", "RF", "StaticMom"]
classification_ensemble_models = ['LR']
model_config = dict(
level_1_models = regression_models if data_config['method'] == 'regression' else classification_models,
level_2_models = regression_ensemble_models if data_config['method'] == 'regression' else classification_ensemble_models
)
return model_config, training_config, data_config
def validate_config(model_config:dict, training_config:dict, data_config:dict):
# We need to make sure there's only one output from the pipeline
# We're not prepared for more than 1 level-2 models at the moment
assert len(model_config["level_2_models"]) <= 1
# If level-2 model is there, we need more than one level-1 models to train
if len(model_config["level_2_models"]) == 1: assert len(model_config["level_1_models"]) > 0
# If there's no level-2 model, we need to have only one level-1 model
if len(model_config["level_2_models"]) == 0: assert len(model_config["level_1_models"]) == 1
def get_model_name(model_config:dict) -> str:
if len(model_config["level_2_models"]) == 1:
return model_config["level_2_models"][0][0]
elif len(model_config["level_1_models"]) == 1:
return model_config["level_1_models"][0][0]
else:
raise Exception("No model name found")