mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-16 12:28:09 +00:00
refactor(Project): removed regression method (we can still use regression models, but we'll need map them to classification later) (#182)
* refactor(Project): removed regression method (we can still use regression models, but we'll need map them to classes later) * fix(Training): removed mistakenly left in `method` parameter
This commit is contained in:
+3
-6
@@ -25,7 +25,6 @@ def get_dev_config() -> tuple[dict, dict, dict]:
|
||||
other_features = ['single_mom'],
|
||||
exogenous_features = ['z_score'],
|
||||
index_column= 'int',
|
||||
method= 'classification',
|
||||
no_of_classes= 'two',
|
||||
narrow_format = False,
|
||||
)
|
||||
@@ -34,7 +33,7 @@ def get_dev_config() -> tuple[dict, dict, dict]:
|
||||
classification_models = ["LogisticRegression_two_class"]
|
||||
|
||||
model_config = dict(
|
||||
primary_models = regression_models if data_config['method'] == 'regression' else classification_models,
|
||||
primary_models = classification_models,
|
||||
meta_labeling_models = [],
|
||||
ensemble_model = None
|
||||
)
|
||||
@@ -69,7 +68,6 @@ def get_default_ensemble_config() -> tuple[dict, dict, dict]:
|
||||
other_features = ['level_2', 'lags_up_to_5'],
|
||||
exogenous_features = ['z_score'],
|
||||
index_column= 'int',
|
||||
method= 'classification',
|
||||
no_of_classes= 'two',
|
||||
narrow_format = False,
|
||||
)
|
||||
@@ -80,7 +78,7 @@ def get_default_ensemble_config() -> tuple[dict, dict, dict]:
|
||||
ensemble_model = 'Average'
|
||||
|
||||
model_config = dict(
|
||||
primary_models = regression_models if data_config['method'] == 'regression' else classification_models,
|
||||
primary_models = classification_models,
|
||||
meta_labeling_models = meta_labeling_models,
|
||||
ensemble_model = ensemble_model
|
||||
)
|
||||
@@ -115,7 +113,6 @@ def get_lightweight_ensemble_config() -> tuple[dict, dict, dict]:
|
||||
other_features = ['level_2'],
|
||||
exogenous_features = ['z_score'],
|
||||
index_column= 'int',
|
||||
method= 'classification',
|
||||
no_of_classes= 'two',
|
||||
narrow_format = False,
|
||||
)
|
||||
@@ -126,7 +123,7 @@ def get_lightweight_ensemble_config() -> tuple[dict, dict, dict]:
|
||||
ensemble_model = 'Average'
|
||||
|
||||
model_config = dict(
|
||||
primary_models = regression_models if data_config['method'] == 'regression' else classification_models,
|
||||
primary_models = classification_models,
|
||||
meta_labeling_models = meta_labeling_models,
|
||||
ensemble_model = ensemble_model
|
||||
)
|
||||
|
||||
@@ -18,7 +18,6 @@ def hash_data_config(data_config: dict) -> str:
|
||||
hash_feature_extractors(data_config['other_features']),
|
||||
hash_feature_extractors(data_config['exogenous_features']),
|
||||
data_config['index_column'],
|
||||
data_config['method'],
|
||||
data_config['no_of_classes'],
|
||||
data_config['narrow_format']
|
||||
]))
|
||||
|
||||
@@ -5,7 +5,7 @@ from models.model_map import get_model_map
|
||||
from data_loader.collections import data_collections
|
||||
|
||||
def preprocess_config(model_config:dict, training_config:dict, data_config:dict) -> tuple[dict, dict, dict]:
|
||||
model_config = __preprocess_model_config(model_config, data_config['method'])
|
||||
model_config = __preprocess_model_config(model_config)
|
||||
data_config = __preprocess_feature_extractors_config(data_config)
|
||||
data_config = __preprocess_data_collections_config(data_config)
|
||||
|
||||
@@ -20,7 +20,7 @@ def __preprocess_feature_extractors_config(data_dict: dict) -> dict:
|
||||
data_dict[key] = flatten([feature_extractor_presets[preset_name] for preset_name in preset_names])
|
||||
return data_dict
|
||||
|
||||
def __preprocess_model_config(model_config:dict, method:str) -> dict:
|
||||
def __preprocess_model_config(model_config:dict) -> dict:
|
||||
model_map = get_model_map(model_config)
|
||||
model_config['primary_models'] = [(model_name, model_map['primary_models'][model_name]) for model_name in model_config['primary_models']]
|
||||
if len(model_config['meta_labeling_models']) > 0:
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
program: run_sweep.py
|
||||
method: grid
|
||||
project: price-forecasting
|
||||
name: Meta labelling
|
||||
metric:
|
||||
goal: maximize
|
||||
name: sharpe
|
||||
parameters:
|
||||
primary_models_meta_labeling:
|
||||
value: True
|
||||
assets:
|
||||
value: ['daily_crypto']
|
||||
other_assets:
|
||||
value: ['daily_etf']
|
||||
exogenous_data:
|
||||
value: ['daily_glassnode']
|
||||
expanding_window_primary:
|
||||
value: True
|
||||
expanding_window_meta_labeling:
|
||||
value: True
|
||||
sliding_window_size_primary:
|
||||
value: 380
|
||||
sliding_window_size_meta_labeling:
|
||||
values: [250, 300, 380]
|
||||
distribution: categorical
|
||||
n_features_to_select:
|
||||
values: [40, 50, 60]
|
||||
distribution: categorical
|
||||
dimensionality_reduction:
|
||||
value: True
|
||||
retrain_every:
|
||||
value: 20
|
||||
scaler:
|
||||
value: 'minmax'
|
||||
no_of_classes:
|
||||
value: 'two'
|
||||
forecasting_horizon:
|
||||
value: 1
|
||||
load_non_target_asset:
|
||||
value: True
|
||||
log_returns:
|
||||
value: True
|
||||
index_column:
|
||||
value: 'int'
|
||||
primary_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_labeling_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']
|
||||
@@ -0,0 +1,61 @@
|
||||
program: run_sweep.py
|
||||
method: bayes
|
||||
project: price-forecasting
|
||||
name: Level-2 models
|
||||
metric:
|
||||
goal: maximize
|
||||
name: sharpe
|
||||
parameters:
|
||||
primary_models_meta_labeling:
|
||||
value: True
|
||||
assets:
|
||||
value: ['daily_crypto']
|
||||
other_assets:
|
||||
value: ['daily_etf']
|
||||
exogenous_data:
|
||||
value: ['daily_glassnode']
|
||||
expanding_window_primary:
|
||||
values: [True, False]
|
||||
distribution: categorical
|
||||
expanding_window_meta_labeling:
|
||||
values: [True, False]
|
||||
distribution: categorical
|
||||
n_features_to_select:
|
||||
values: [10, 20, 30]
|
||||
distribution: categorical
|
||||
dimensionality_reduction:
|
||||
value: True
|
||||
sliding_window_size_primary:
|
||||
values: [180, 280, 380]
|
||||
distribution: categorical
|
||||
sliding_window_size_meta_labeling:
|
||||
values: [180, 280, 380]
|
||||
distribution: categorical
|
||||
retrain_every:
|
||||
values: [10, 20, 30]
|
||||
distribution: categorical
|
||||
scaler:
|
||||
value: 'minmax'
|
||||
no_of_classes:
|
||||
values: ['two', 'three-balanced', 'three-imbalanced']
|
||||
distribution: categorical
|
||||
forecasting_horizon:
|
||||
value: 1
|
||||
load_non_target_asset:
|
||||
values: [True, False]
|
||||
distribution: categorical
|
||||
log_returns:
|
||||
value: True
|
||||
index_column:
|
||||
value: 'int'
|
||||
primary_models:
|
||||
value: ["LogisticRegression_two_class", "LDA", "KNN", "CART", "NB", "AB", "RFC", "StaticMom"]
|
||||
meta_labeling_models:
|
||||
values: ["LogisticRegression_two_class", "LDA", "KNN", "CART", "NB", "AB", "RFC"]
|
||||
distribution: categorical
|
||||
own_features:
|
||||
values: [['single_mom', 'date_days'], [], ['level_1', 'date_days'], ['date_days', 'level_2']]
|
||||
distribution: categorical
|
||||
other_features:
|
||||
values: [[], ['level_1']]
|
||||
distribution: categorical
|
||||
@@ -0,0 +1,55 @@
|
||||
program: run_sweep.py
|
||||
method: grid
|
||||
project: price-forecasting
|
||||
name: Level-1 models
|
||||
metric:
|
||||
goal: maximize
|
||||
name: sharpe
|
||||
parameters:
|
||||
primary_models_meta_labeling:
|
||||
value: True
|
||||
assets:
|
||||
value: ['daily_crypto']
|
||||
other_assets:
|
||||
value: ['daily_etf']
|
||||
exogenous_data:
|
||||
value: ['daily_glassnode']
|
||||
expanding_window_primary:
|
||||
values: [True, False]
|
||||
distribution: categorical
|
||||
expanding_window_meta_labeling:
|
||||
value: False
|
||||
n_features_to_select:
|
||||
value: 50
|
||||
dimensionality_reduction:
|
||||
value: True
|
||||
sliding_window_size_primary:
|
||||
value: 380
|
||||
sliding_window_size_meta_labeling:
|
||||
value: 380
|
||||
retrain_every:
|
||||
values: [10, 20, 30]
|
||||
distribution: categorical
|
||||
scaler:
|
||||
value: 'minmax'
|
||||
no_of_classes:
|
||||
value: 'two'
|
||||
forecasting_horizon:
|
||||
value: 1
|
||||
load_non_target_asset:
|
||||
value: True
|
||||
log_returns:
|
||||
value: True
|
||||
index_column:
|
||||
value: 'int'
|
||||
primary_models:
|
||||
values: [['LogisticRegression_two_class'], ['SVC'], ['LDA'], ['KNN'], ['CART'], ['MNB'], ['NB'], ['AB'], ['RFC'], ['XGB_two_class'], ['LGBM']]
|
||||
distribution: categorical
|
||||
meta_labeling_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']
|
||||
Reference in New Issue
Block a user