MCPcopy Create free account
hub / github.com/FinancialComputingUCL/LOBFrame / create_hyperparameters_yaml

Function create_hyperparameters_yaml

utils.py:591–655  ·  view source on GitHub ↗

Create and save a YAML file containing the hyperparameters as part of an experiment. Args: experiment_id (str): ID of the experiment. args (any): Stage's arguments. Returns: None.

(experiment_id: str, args: Any)

Source from the content-addressed store, hash-verified

589
590
591def create_hyperparameters_yaml(experiment_id: str, args: Any) -> None:
592 """
593 Create and save a YAML file containing the hyperparameters as part of an experiment.
594 Args:
595 experiment_id (str): ID of the experiment.
596 args (any): Stage's arguments.
597
598 Returns:
599 None.
600 """
601 training_stocks = list(
602 args.training_stocks.split(",")
603 ) # Parsing of 'training_stocks' input argument.
604 target_stocks = list(
605 args.target_stocks.split(",")
606 ) # Parsing of 'target_stocks' input argument.
607 horizons = list(
608 map(int, args.horizons.split(","))
609 ) # Parsing of 'horizons' input argument.
610 stages = list(args.stages.split(",")) # Parsing of 'stages' input argument.
611
612 # Create a dictionary (YAML structure) containing the hyperparameters.
613 data = {
614 "general": {
615 "dataset": args.dataset,
616 "model": args.model,
617 "training_stocks": training_stocks,
618 "target_stocks": target_stocks,
619 "normalization_window": args.normalization_window,
620 "horizons": horizons,
621 "training_ratio": args.training_ratio,
622 "validation_ratio": args.validation_ratio,
623 "test_ratio": args.test_ratio,
624 "stages": stages,
625 "include_target_stock_in_training": args.include_target_stock_in_training,
626 "targets_type": args.targets_type,
627 },
628 "model": {
629 "batch_size": args.batch_size,
630 "epochs": args.epochs,
631 "learning_rate": args.learning_rate,
632 "num_workers": args.num_workers,
633 "history_length": args.history_length,
634 "shuffling_seed": args.shuffling_seed,
635 "lighten": args.lighten,
636 "threshold": args.threshold,
637 "prediction_horizon": args.prediction_horizon,
638 "balanced_sampling": args.balanced_sampling,
639 "patience": args.patience,
640 },
641 "trading": {
642 "initial_cash": args.initial_cash,
643 "trading_fee": args.trading_fee,
644 "mid_side_trading": args.mid_side_trading,
645 "simulation_type": args.simulation_type,
646 "probability_threshold": args.probability_threshold,
647 },
648 }

Callers 1

main.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected