mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-09 09:07:49 +00:00
6b26643ece
* feat(Transformations): removed feature-selection pre-processing step completely * fix(Core): removed unnecessary `original_X` * fix(Transformations): use the X_expanding_window to transform subsequent data * fix(RFE): should check for model correctly * fix(Config): only re-train the model every 40 timestamp * fix(MetaLabeling): pass in the correct X to meta-labeling step * fix(Transformation): PCA should at least keep as many features as sliding_window_size * feat(Transformations): cache transformations across the same asset * fix(Tests): missing preloaded_transformations arg * chore(Config): got rid of unnecessary 'classification_models' and 'regression_models' dictionary keys
134 lines
4.3 KiB
Python
134 lines
4.3 KiB
Python
|
|
def get_dev_config() -> tuple[dict, dict, dict]:
|
|
|
|
training_config = dict(
|
|
primary_models_meta_labeling = False,
|
|
dimensionality_reduction = False,
|
|
n_features_to_select = 30,
|
|
expanding_window_primary = False,
|
|
expanding_window_meta_labeling = False,
|
|
sliding_window_size_primary = 380,
|
|
sliding_window_size_meta_labeling = 1,
|
|
retrain_every = 20,
|
|
scaler = 'minmax', # 'normalize' 'minmax' 'standardize'
|
|
)
|
|
|
|
data_config = dict(
|
|
assets = ['daily_only_btc'],
|
|
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 = ['z_score'],
|
|
index_column= 'int',
|
|
method= 'classification',
|
|
no_of_classes= 'two',
|
|
narrow_format = False,
|
|
)
|
|
|
|
regression_models = ["Lasso"]
|
|
classification_models = ["LogisticRegression_two_class"]
|
|
|
|
model_config = dict(
|
|
primary_models = regression_models if data_config['method'] == 'regression' else classification_models,
|
|
meta_labeling_models = [],
|
|
ensemble_model = None
|
|
)
|
|
|
|
return model_config, training_config, data_config
|
|
|
|
|
|
|
|
def get_default_ensemble_config() -> tuple[dict, dict, dict]:
|
|
|
|
training_config = dict(
|
|
primary_models_meta_labeling = True,
|
|
dimensionality_reduction = False,
|
|
n_features_to_select = 30,
|
|
expanding_window_primary = False,
|
|
expanding_window_meta_labeling = True,
|
|
sliding_window_size_primary = 380,
|
|
sliding_window_size_meta_labeling = 240,
|
|
retrain_every = 40,
|
|
scaler = 'minmax', # 'normalize' 'minmax' 'standardize'
|
|
)
|
|
|
|
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 = ['z_score'],
|
|
index_column= 'int',
|
|
method= 'classification',
|
|
no_of_classes= 'two',
|
|
narrow_format = False,
|
|
)
|
|
|
|
regression_models = ["Lasso", "KNN", "RFR"]
|
|
classification_models = ["LogisticRegression_two_class", "LDA", "NB", "RFC", "XGB_two_class", "LGBM", "StaticMom"]
|
|
meta_labeling_models = ['LogisticRegression_two_class', 'LGBM']
|
|
ensemble_model = 'Average'
|
|
|
|
model_config = dict(
|
|
primary_models = regression_models if data_config['method'] == 'regression' else classification_models,
|
|
meta_labeling_models = meta_labeling_models,
|
|
ensemble_model = ensemble_model
|
|
)
|
|
|
|
return model_config, training_config, data_config
|
|
|
|
|
|
|
|
def get_lightweight_ensemble_config() -> tuple[dict, dict, dict]:
|
|
|
|
training_config = dict(
|
|
primary_models_meta_labeling = True,
|
|
dimensionality_reduction = True,
|
|
n_features_to_select = 30,
|
|
expanding_window_primary = False,
|
|
expanding_window_meta_labeling = True,
|
|
sliding_window_size_primary = 380,
|
|
sliding_window_size_meta_labeling = 240,
|
|
retrain_every = 40,
|
|
scaler = 'minmax', # 'normalize' 'minmax' 'standardize'
|
|
)
|
|
|
|
data_config = dict(
|
|
assets = ['daily_crypto_lightweight'],
|
|
other_assets = ['daily_etf'],
|
|
exogenous_data = ['daily_glassnode'],
|
|
load_non_target_asset= True,
|
|
log_returns= True,
|
|
forecasting_horizon = 1,
|
|
own_features = ['level_2' ],
|
|
other_features = ['level_2'],
|
|
exogenous_features = ['z_score'],
|
|
index_column= 'int',
|
|
method= 'classification',
|
|
no_of_classes= 'two',
|
|
narrow_format = False,
|
|
)
|
|
|
|
regression_models = ["Lasso", "KNN"]
|
|
classification_models = ['LogisticRegression_two_class', 'SVC']
|
|
meta_labeling_models = ['LogisticRegression_two_class', 'LGBM']
|
|
ensemble_model = 'Average'
|
|
|
|
model_config = dict(
|
|
primary_models = regression_models if data_config['method'] == 'regression' else classification_models,
|
|
meta_labeling_models = meta_labeling_models,
|
|
ensemble_model = ensemble_model
|
|
)
|
|
|
|
return model_config, training_config, data_config
|
|
|
|
|