mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-23 07:48:09 +00:00
fix(Config): adjusted parameters to 5 minute timeframe
This commit is contained in:
@@ -96,7 +96,10 @@ def __preprocess_event_labeller_config(config_dict: dict) -> dict:
|
|||||||
def __preprocess_transformations_config(config_dict: dict) -> dict:
|
def __preprocess_transformations_config(config_dict: dict) -> dict:
|
||||||
transformations = [
|
transformations = [
|
||||||
get_scaler(config_dict["scaler"]),
|
get_scaler(config_dict["scaler"]),
|
||||||
get_pca(config_dict["dimensionality_reduction_ratio"], config_dict["sliding_window_size"]),
|
get_pca(
|
||||||
|
config_dict["dimensionality_reduction_ratio"],
|
||||||
|
config_dict["sliding_window_size"],
|
||||||
|
),
|
||||||
get_rfe(config_dict["n_features_to_select"]),
|
get_rfe(config_dict["n_features_to_select"]),
|
||||||
]
|
]
|
||||||
transformations = [x for x in transformations if x is not None]
|
transformations = [x for x in transformations if x is not None]
|
||||||
|
|||||||
+4
-39
@@ -1,42 +1,7 @@
|
|||||||
from .types import RawConfig, Config
|
from .types import RawConfig, Config
|
||||||
|
|
||||||
|
|
||||||
def get_default_ensemble_config() -> RawConfig:
|
def get_default_config() -> RawConfig:
|
||||||
|
|
||||||
classification_models = [
|
|
||||||
"LogisticRegression_two_class",
|
|
||||||
"LDA",
|
|
||||||
"NB",
|
|
||||||
"RFC",
|
|
||||||
"XGB_two_class",
|
|
||||||
"LGBM",
|
|
||||||
"StaticMom",
|
|
||||||
]
|
|
||||||
meta_models = ["LogisticRegression_two_class", "LGBM"]
|
|
||||||
|
|
||||||
return RawConfig(
|
|
||||||
dimensionality_reduction_ratio=0.5,
|
|
||||||
n_features_to_select=30,
|
|
||||||
sliding_window_size=380,
|
|
||||||
retrain_every=10,
|
|
||||||
scaler="minmax", # 'normalize' 'minmax' 'standardize'
|
|
||||||
assets=["daily_crypto"],
|
|
||||||
target_asset="BTC_USD",
|
|
||||||
other_assets=["daily_etf"],
|
|
||||||
exogenous_data=["daily_glassnode"],
|
|
||||||
load_non_target_asset=True,
|
|
||||||
own_features=["level_2", "date_days", "lags_up_to_5"],
|
|
||||||
other_features=["level_2", "lags_up_to_5"],
|
|
||||||
exogenous_features=["z_score"],
|
|
||||||
directional_models=classification_models,
|
|
||||||
meta_models=meta_models,
|
|
||||||
event_filter="cusum_vol",
|
|
||||||
labeling="two_class",
|
|
||||||
forecasting_horizon=100,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def get_lightweight_ensemble_config() -> RawConfig:
|
|
||||||
|
|
||||||
classification_models = [
|
classification_models = [
|
||||||
"LogisticRegression_two_class",
|
"LogisticRegression_two_class",
|
||||||
@@ -58,9 +23,9 @@ def get_lightweight_ensemble_config() -> RawConfig:
|
|||||||
target_asset="BTC_USD",
|
target_asset="BTC_USD",
|
||||||
other_assets=[],
|
other_assets=[],
|
||||||
exogenous_data=[],
|
exogenous_data=[],
|
||||||
load_non_target_asset=False,
|
load_non_target_asset=True,
|
||||||
own_features=["level_1"],
|
own_features=["level_2"],
|
||||||
other_features=[],
|
other_features=["z_score"],
|
||||||
exogenous_features=[],
|
exogenous_features=[],
|
||||||
directional_models=classification_models,
|
directional_models=classification_models,
|
||||||
meta_models=meta_models,
|
meta_models=meta_models,
|
||||||
|
|||||||
@@ -18,7 +18,4 @@ def check_data(X: XDataFrame, config: Config) -> bool:
|
|||||||
def has_enough_samples_to_train(X: XDataFrame, config: Config) -> bool:
|
def has_enough_samples_to_train(X: XDataFrame, config: Config) -> bool:
|
||||||
first_valid_index = get_first_valid_return_index(X.iloc[:, 0])
|
first_valid_index = get_first_valid_return_index(X.iloc[:, 0])
|
||||||
samples_to_train = len(X) - first_valid_index
|
samples_to_train = len(X) - first_valid_index
|
||||||
return (
|
return samples_to_train > (config.sliding_window_size * 2) + 100
|
||||||
samples_to_train
|
|
||||||
> (config.sliding_window_size *2) + 100
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ __presets = dict(
|
|||||||
debug_future_lookahead=[("debug_future", feature_debug_future_lookahead, [1])],
|
debug_future_lookahead=[("debug_future", feature_debug_future_lookahead, [1])],
|
||||||
single_mom=[("mom", feature_mom, [30])],
|
single_mom=[("mom", feature_mom, [30])],
|
||||||
single_vol=[("vol", feature_vol, [30])],
|
single_vol=[("vol", feature_vol, [30])],
|
||||||
mom=[("mom", feature_mom, [10, 20, 30, 60, 90])],
|
mom=[("mom", feature_mom, [100, 300, 600, 900, 1800])],
|
||||||
vol=[("vol", feature_vol, [10, 20, 30, 60])],
|
vol=[("vol", feature_vol, [100, 300, 600, 1800])],
|
||||||
lags_up_to_5=[("lag", feature_lag, [1, 2, 3, 4, 5])],
|
lags_up_to_5=[("lag", feature_lag, [1, 2, 3, 4, 5])],
|
||||||
lags_up_to_10=[("lag", feature_lag, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])],
|
lags_up_to_10=[("lag", feature_lag, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])],
|
||||||
date_all=[
|
date_all=[
|
||||||
@@ -35,13 +35,13 @@ __presets = dict(
|
|||||||
("day_of_week", feature_day_of_week, [0]),
|
("day_of_week", feature_day_of_week, [0]),
|
||||||
("day_of_month", feature_day_of_month, [0]),
|
("day_of_month", feature_day_of_month, [0]),
|
||||||
],
|
],
|
||||||
roc=[("roc", feature_ROC, [10, 30])],
|
roc=[("roc", feature_ROC, [100, 300])],
|
||||||
rsi=[("rsi", feature_ROC, [10, 30, 100])],
|
rsi=[("rsi", feature_ROC, [100, 300, 1000])],
|
||||||
stod=[("stod", feature_STOD, [10, 30, 200])],
|
stod=[("stod", feature_STOD, [100, 300, 2000])],
|
||||||
stok=[("stok", feature_STOK, [10, 30, 200])],
|
stok=[("stok", feature_STOK, [100, 300, 2000])],
|
||||||
fracdiff=[("fracdiff", feature_fractional_differentiation, [10, 30])],
|
fracdiff=[("fracdiff", feature_fractional_differentiation, [100, 300])],
|
||||||
fracdiff_log=[("fracdiff_log", feature_fractional_differentiation_log, [10, 30])],
|
fracdiff_log=[("fracdiff_log", feature_fractional_differentiation_log, [100, 300])],
|
||||||
z_score=[("z_score", feature_expanding_zscore, [10])],
|
z_score=[("z_score", feature_expanding_zscore, [100])],
|
||||||
)
|
)
|
||||||
|
|
||||||
presets = __presets | dict(
|
presets = __presets | dict(
|
||||||
|
|||||||
+2
-7
@@ -4,10 +4,7 @@ from reporting.saving import load_models
|
|||||||
|
|
||||||
from run_pipeline import run_pipeline
|
from run_pipeline import run_pipeline
|
||||||
from config.types import Config, RawConfig
|
from config.types import Config, RawConfig
|
||||||
from config.presets import (
|
from config.presets import get_default_config
|
||||||
get_default_ensemble_config,
|
|
||||||
get_lightweight_ensemble_config,
|
|
||||||
)
|
|
||||||
from labeling.process import label_data
|
from labeling.process import label_data
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
@@ -84,6 +81,4 @@ def __inference(config: Config, pipeline_outcome: PipelineOutcome):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
run_inference(
|
run_inference(preload_models=True, fallback_raw_config=get_default_config())
|
||||||
preload_models=True, fallback_raw_config=get_lightweight_ensemble_config()
|
|
||||||
)
|
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@ from typing import Optional
|
|||||||
|
|
||||||
from config.types import Config, RawConfig
|
from config.types import Config, RawConfig
|
||||||
from config.preprocess import preprocess_config
|
from config.preprocess import preprocess_config
|
||||||
from config.presets import get_default_ensemble_config, get_lightweight_ensemble_config
|
from config.presets import get_default_config
|
||||||
|
|
||||||
from data_loader.load import load_data
|
from data_loader.load import load_data
|
||||||
from data_loader.process import check_data
|
from data_loader.process import check_data
|
||||||
@@ -109,5 +109,5 @@ if __name__ == "__main__":
|
|||||||
project_name="price-prediction",
|
project_name="price-prediction",
|
||||||
with_wandb=False,
|
with_wandb=False,
|
||||||
sweep=False,
|
sweep=False,
|
||||||
raw_config=get_lightweight_ensemble_config(),
|
raw_config=get_default_config(),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user