feat(HPO): added run_hpo script (#237)

* feat(HPO): added `run_hpo` script

* fix(Linter): ran

* feat(HPO): removed any reference to sweep (superseeded by optuna)

* fix(HPO): optimize for sharpe

* fix(Config): removed glassnode data, save trials from hpo

* feat(Labelling): added three-balanced method works again

* fix(BetSizing): set the correct class labels

* fix(HPO): powerset should return what's expected, added two new normalization methods

* fix(Linter): ran

* fix(DataLoader): sort the dataframe when fetching data

* fix(Config): only take z-score of other assets
This commit is contained in:
Mark Aron Szulyovszky
2022-03-15 14:43:16 +01:00
committed by GitHub
parent 345b48a67c
commit b5ddee8dce
30 changed files with 126 additions and 115 deletions
+10 -14
View File
@@ -19,31 +19,28 @@ from training.types import PipelineOutcome
def run_pipeline(
project_name: str, with_wandb: bool, sweep: bool, raw_config: RawConfig
project_name: str, with_wandb: bool, raw_config: RawConfig
) -> tuple[PipelineOutcome, Config]:
wandb, config = setup_config(project_name, with_wandb, sweep, raw_config)
pipeline_outcome = run_training(config)
wandb, config = setup_config(project_name, with_wandb, raw_config)
outcome = run_training(config)
report_results(
pipeline_outcome.directional_training.stats,
pipeline_outcome.get_output_stats(),
pipeline_outcome.get_output_weights(),
outcome.directional_training.stats,
outcome.get_output_stats(),
outcome.get_output_weights(),
config,
wandb,
sweep,
)
if config.save_models:
save_models(pipeline_outcome, config)
return pipeline_outcome, config
save_models(outcome, config)
return outcome, config
def setup_config(
project_name: str, with_wandb: bool, sweep: bool, raw_config: RawConfig
project_name: str, with_wandb: bool, raw_config: RawConfig
) -> tuple[Optional[object], Config]:
wandb = None
if with_wandb:
wandb = launch_wandb(
project_name=project_name, default_config=raw_config, sweep=sweep
)
wandb = launch_wandb(project_name=project_name, default_config=raw_config)
raw_config = override_config_with_wandb_values(wandb, raw_config)
config = preprocess_config(raw_config)
@@ -108,6 +105,5 @@ if __name__ == "__main__":
run_pipeline(
project_name="price-prediction",
with_wandb=False,
sweep=False,
raw_config=get_default_config(),
)