mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-04 14:47:49 +00:00
refactor(Config): use a Config object instead of dictionary of dictionaries! (#184)
* refactor(Config): use a Config object instead of dictionary of dictionaries! * fix(Config): use default_ensemble_config * fix(Portfolio): fixed portfolio construction
This commit is contained in:
committed by
GitHub
parent
5c4a5b0cf1
commit
e80fffdb65
+4
-2
@@ -4,6 +4,8 @@ import os
|
||||
import string
|
||||
import random
|
||||
from typing import Union
|
||||
from config.config import Config
|
||||
|
||||
|
||||
def get_files_from_dir(path: str) -> list[str]:
|
||||
return [f for f in os.listdir(path) if os.path.isfile(os.path.join(path,f)) and not f.startswith('.')]
|
||||
@@ -17,10 +19,10 @@ def get_first_valid_return_index(series: pd.Series) -> int:
|
||||
return 0
|
||||
return nested_result[0]
|
||||
|
||||
def has_enough_samples_to_train(X: pd.DataFrame, y: pd.Series, training_config: dict) -> bool:
|
||||
def has_enough_samples_to_train(X: pd.DataFrame, y: pd.Series, config: Config) -> bool:
|
||||
first_valid_index = get_first_valid_return_index(X.iloc[:,0])
|
||||
samples_to_train = len(y) - first_valid_index
|
||||
return samples_to_train > training_config['sliding_window_size_primary'] + training_config['sliding_window_size_meta_labeling'] + 100
|
||||
return samples_to_train > config.sliding_window_size_base + config.sliding_window_size_meta_labeling + 100
|
||||
|
||||
def flatten(list_of_lists: list) -> list:
|
||||
return [item for sublist in list_of_lists for item in sublist]
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ Name = str
|
||||
FeatureExtractorConfig = tuple[Name, FeatureExtractor, list[Period]]
|
||||
Path = str
|
||||
FileName = str
|
||||
DataSource = list[tuple[Path, FileName]]
|
||||
DataSource = tuple[Path, FileName]
|
||||
DataCollection = list[DataSource]
|
||||
|
||||
ScalerTypes = Literal['normalize', 'minmax', 'standardize', 'none']
|
||||
Reference in New Issue
Block a user