Files
drift/config/config.py
T
Mark Aron Szulyovszky 1cd0119589 feat(DataLoader): caching MVP, added ability to use standard scaling for exogenous data, scaling is now also done before feature selection (#105)
* fix(FeatureExtractor): apply log to transform some series to normality

* feat(DataLoader): add ability of not returning returns when they're not needed (exogenous data), applied log to certain features

* feat(FeatureExtractors): added standard scaling for exogenous data

* feat(FeatureSelection): scale data with the passed in scaler before doing feature-selection

* fix(Config): sweep config

* feat(Models): output probability, store it

* feat(Core): added caching to select_features() and load_data()

* fix(Dependencies): added diskcache

* fix(Training): error when creating results DF

* feat(Models): added xgboost, fixed tests

* refactor(Cache): moved hashing to a separate function, created wrapper functions to separate business logic and caching

* fix(Tests): new syntax

* fix(Model): XGboost can't handle -1 class, so we'll use the deprecated label_encoder fornow

* fix(Model): XGBoost config

* feat(Cache): add run_clear_cache script

* fix(Pipeline) accidentally re-instatiating all_predictions for each asset
2022-01-04 11:44:35 +01:00

132 lines
4.4 KiB
Python

def get_default_level_1_daily_config() -> tuple[dict, dict, dict]:
training_config = dict(
dimensionality_reduction = True,
feature_selection = True,
n_features_to_select = 30,
expanding_window_level1 = False,
expanding_window_level2 = False,
sliding_window_size_level1 = 380,
sliding_window_size_level2 = 1,
retrain_every = 20,
scaler = 'minmax', # 'normalize' 'minmax' 'standardize' 'none'
include_original_data_in_ensemble = False,
)
data_config = dict(
assets = ['daily_crypto'],
other_assets = [],
exogenous_data = [],
load_non_target_asset= True,
log_returns= True,
forecasting_horizon = 1,
own_features = ['level_2', 'date_days'],
other_features = ['single_mom'],
exogenous_features = ['standard_scaling'],
index_column= 'int',
method= 'classification',
no_of_classes= 'three-balanced',
narrow_format = False,
)
regression_models = ["Lasso"]
classification_models = ["KNN"]
model_config = dict(
level_1_models = regression_models if data_config['method'] == 'regression' else classification_models,
level_2_model = None
)
return model_config, training_config, data_config
def get_default_level_2_hourly_config() -> tuple[dict, dict, dict]:
training_config = dict(
dimensionality_reduction = True,
feature_selection = True,
n_features_to_select = 30,
expanding_window_level1 = True,
expanding_window_level2 = False,
sliding_window_size_level1 = 2480,
sliding_window_size_level2 = 1,
retrain_every = 100,
scaler = 'minmax', # 'normalize' 'minmax' 'standardize' 'none'
include_original_data_in_ensemble = False,
)
data_config = dict(
assets = ['hourly_crypto'],
other_assets = [],
exogenous_data = [],
load_non_target_asset= True,
log_returns= True,
forecasting_horizon = 1,
own_features = ['level_2', 'date_days', 'lags_up_to_5'],
other_features = ['level_2'],
exogenous_features = ['standard_scaling'],
index_column= 'int',
method= 'classification',
no_of_classes= 'three-balanced',
narrow_format = False,
)
regression_models = ["Lasso", "KNN", "RF"]
regression_ensemble_model = 'KNN'
classification_models = ["LDA", "KNN", "CART", "RF", "StaticMom"]
classification_ensemble_model = 'Ensemble_Average'
model_config = dict(
level_1_models = regression_models if data_config['method'] == 'regression' else classification_models,
level_2_model = regression_ensemble_model if data_config['method'] == 'regression' else classification_ensemble_model
)
return model_config, training_config, data_config
def get_default_level_2_daily_config() -> tuple[dict, dict, dict]:
training_config = dict(
dimensionality_reduction = True,
feature_selection = True,
n_features_to_select = 30,
expanding_window_level1 = True,
expanding_window_level2 = False,
sliding_window_size_level1 = 380,
sliding_window_size_level2 = 1,
retrain_every = 20,
scaler = 'minmax', # 'normalize' 'minmax' 'standardize' 'none'
include_original_data_in_ensemble = False,
)
data_config = dict(
assets = ['daily_crypto'],
other_assets = ['daily_etf'],
exogenous_data = ['daily_glassnode'],
load_non_target_asset= True,
log_returns= True,
forecasting_horizon = 1,
own_features = ['level_2', 'date_days', 'lags_up_to_5'],
other_features = ['level_2', 'lags_up_to_5'],
exogenous_features = ['standard_scaling'],
index_column= 'int',
method= 'classification',
no_of_classes= 'three-balanced',
narrow_format = False,
)
regression_models = ["Lasso", "KNN", "RF"]
regression_ensemble_model = 'KNN'
classification_models = ['LR', 'LDA', 'KNN', 'CART', 'NB', 'AB', 'RF', 'XGB', 'StaticMom']
classification_ensemble_model = 'Ensemble_Average'
model_config = dict(
level_1_models = regression_models if data_config['method'] == 'regression' else classification_models,
level_2_model = regression_ensemble_model if data_config['method'] == 'regression' else classification_ensemble_model
)
return model_config, training_config, data_config