Configuration object

class hy2dl.utils.config.Config(yml_path_or_dict: dict, base_dir: Path, dev_mode: bool = False)

Bases: object

Read run configuration from the specified path or dictionary and parse it into a configuration object.

Parameters:
  • yml_path_or_dict (Union[str, dict]) – Either a path to the config file or a dictionary of configuration values.

  • base_dir (Path) – Base directory. It is use to resolve relative paths in the configuration.

  • dev_mode (bool, default=False) –

    Whether to skip some checks for unknown keys in the configuration. This can be useful during development when

    the configuration is still changing frequently.

    This class is based on Neural Hydrology [1] and adapted for our specific case.

References

property ar_teacher_forcing: bool
property batch_size_evaluation: int
property batch_size_training: int
property conceptual_model: str | None
property custom_scaler: dict[str, dict[str, float]] | None
property custom_seq_processing: dict[str, dict[str, int]] | None
property custom_seq_processing_flag: bool
property dataset: str
property dataset_in_ram: bool
property device: str
property distribution: str
property dropout_rate: float
dump() None

Write the current configuration to a YAML file.

property dynamic_embedding: dict[str, str | float | list[int]] | None
property dynamic_input: list[str] | dict[str, list[str] | dict[str, list[str]]]
property dynamic_input_conceptual_model: dict[str, str | list[str]] | None
property dynamic_parameterization_conceptual_model: list[str]
property epochs: int
property experiment_name: str
property forcings: list[str]
property forecast_counter: bool | None
property forecast_dataset_in_ram: bool
property forecast_input: list[str] | dict[str, list[str]]
property hidden_size: int
init_experiment()

Create folder structure and get the logger where the experiment progress will be reported

property initial_forget_bias: float
property lagged_features: dict[str, int | list[int]] | None
property learning_rate: float | dict[str, float]
property loss: str
property max_updates_per_epoch: int
property model: str
property nan_handling_method: str | None
property nan_probabilistic_masking: bool
property nan_probability: dict[str, dict[str, float]] | None
property noise_level: float | None
property num_conceptual_models: int
property num_mixture_components: int
property num_workers: int
property optimizer: str
property output_features: int
property path_additional_features: Path | None
property path_data: Path
property path_dataset_testing: Path | None
property path_dataset_training: Path | None
property path_dataset_validation: Path | None
property path_entities: Path | None
property path_entities_testing: Path | None
property path_entities_training: Path | None
property path_entities_validation: Path | None
property path_forecast_dataset: Path | None
property path_save_folder: Path
property path_save_zarr: Path | None
property path_valid_samples_testing: Path | None
property path_valid_samples_training: Path | None
property path_valid_samples_validation: Path | None
property predict_last_n: int
property pseudo_forecast_ar_input: list[str]
property pseudo_forecast_input: list[str] | dict[str, list[str]]
property ram_safety_factor: float
property random_seed: int
property routing_model: str | None
property seq_length: int
property seq_length_forecast: int
property seq_length_hindcast: int
property static_embedding: dict[str, str | float | list[int]] | None
property static_input: list[str]
property steplr_gamma: float | None
property steplr_step_size: int | None
property target: list[str]
property target_weights: list[float]
property teacher_forcing_scheduler: dict[str, float] | None
property testing_metrics: list[str]
property testing_period: list[str]
property training_period: list[str]
property unique_prediction_blocks: bool
property validate_every: int
property validation_metric: list[str]
property validation_period: list[str]