model.runtime.configs.site_learning_configΒΆ

Site-learning runtime configuration.

Module ContentsΒΆ

ClassesΒΆ

TargetVariableConfig

One observed target variable under site_learning.targets.<name>.

TargetConfig

All observed target variables under the site_learning.targets block.

TrainingConfig

Optimizer and training-schedule settings under site_learning.training.

CrossValidationConfig

Cross-validation protocol under site_learning.cross_validation.

SiteLearningInitializationConfig

NN-weight initialization under site_learning.initialization.

APIΒΆ

class model.runtime.configs.site_learning_config.TargetVariableConfigΒΆ

Bases: model.runtime.configs.base_config.BaseConfig

One observed target variable under site_learning.targets.<name>.

Attributes

mapping : str or list Name of the variable in the target NetCDF, optionally [name, scale]. layer : int, optional 1-based soil layer to select when the model output is layer-wise. sample_loss_weight : float Relative weight of this target’s sample-level loss in the total loss. site_loss_weight : float Weight of this target’s site-level (per-site mean) loss; 0 disables it.

mapping: objectΒΆ

None

layer: objectΒΆ

None

sample_loss_weight: floatΒΆ

1.0

site_loss_weight: floatΒΆ

1.0

classmethod from_raw(name, raw)ΒΆ
validate()ΒΆ
apply_layer_selection(tensor, label)ΒΆ
class model.runtime.configs.site_learning_config.TargetConfigΒΆ

Bases: model.runtime.configs.base_config.BaseConfig

All observed target variables under the site_learning.targets block.

Each key is a target name mapped to a :class:TargetVariableConfig. Sample-loss weights are normalised across targets so their relative magnitude, not absolute scale, determines the multi-objective balance.

specs: dict[str, model.runtime.configs.site_learning_config.TargetVariableConfig]ΒΆ

β€˜field(…)’

classmethod from_dict(raw)ΒΆ
property normalized_sample_loss_weightsΒΆ
property variable_namesΒΆ
property variablesΒΆ
property loader_mappingΒΆ
validate()ΒΆ
class model.runtime.configs.site_learning_config.TrainingConfigΒΆ

Bases: model.runtime.configs.base_config.BaseConfig

Optimizer and training-schedule settings under site_learning.training.

Attributes

num_epochs, lr, weight_decay, seed : int / float Core optimizer settings for the Adam optimizer. train_chunk_size : int, optional Number of timesteps per backpropagation chunk; None uses the full record. Smaller chunks reduce memory and backprop depth. max_grad_norm : float Gradient-norm clipping threshold. val_within_train_enabled, val_fraction : bool / float Hold out a fraction of the training data for in-training validation. early_stopping_* : Patience-based early stopping on the validation metric. reduce_lr_* : ReduceLROnPlateau schedule parameters. min_sites_for_site_loss, min_samples_per_site_for_site_loss : int Thresholds below which the site-level loss is skipped (too few sites or too few samples per site to form a stable per-site mean).

num_epochs: intΒΆ

10

lr: floatΒΆ

0.001

seed: intΒΆ

42

train_chunk_size: objectΒΆ

None

chunk_months: intΒΆ

3

max_grad_norm: floatΒΆ

1.0

weight_decay: floatΒΆ

0.0001

loss_fn: strΒΆ

β€˜kge’

kge_weights: objectΒΆ

(1.0, 1.0, 1.0)

debug: boolΒΆ

False

val_within_train_enabled: boolΒΆ

True

val_fraction: floatΒΆ

0.3

early_stopping_enabled: boolΒΆ

True

early_stopping_patience: intΒΆ

10

early_stopping_min_delta: floatΒΆ

0.0

reduce_lr_enabled: boolΒΆ

True

reduce_lr_patience: intΒΆ

5

reduce_lr_factor: floatΒΆ

0.5

reduce_lr_min_delta: floatΒΆ

0.0

reduce_lr_min_lr: floatΒΆ

1e-06

min_sites_for_site_loss: intΒΆ

10

min_samples_per_site_for_site_loss: intΒΆ

365

classmethod from_dict(raw)ΒΆ
validate()ΒΆ
class model.runtime.configs.site_learning_config.CrossValidationConfigΒΆ

Bases: model.runtime.configs.base_config.BaseConfig

Cross-validation protocol under site_learning.cross_validation.

Attributes

enabled : bool Whether to run cross-validation rather than a single train/val split. scheme : str or None spatial (split by site) or temporal (split by time period). n_folds : int Number of CV folds. cv_seed, shuffle : int / bool Control random fold assignment for the spatial-random mode. spatial_mode : str random for randomly assigned folds, or predefined to read fold membership from spatial_fold_path. spatial_fold_path : str, optional Path to a fold-definition file; required when spatial_mode is predefined.

enabled: boolΒΆ

False

scheme: objectΒΆ

None

n_folds: intΒΆ

5

cv_seed: intΒΆ

42

spatial_mode: strΒΆ

β€˜random’

spatial_fold_path: objectΒΆ

None

shuffle: boolΒΆ

True

classmethod from_dict(raw)ΒΆ
validate()ΒΆ
class model.runtime.configs.site_learning_config.SiteLearningInitializationConfigΒΆ

Bases: model.runtime.configs.base_config.BaseConfig

NN-weight initialization under site_learning.initialization.

Attributes

init_nn_weights_path : str, optional Checkpoint of pretrained NN parameter weights to warm-start from. frozen_parameters : list[str] Names of learnable parameters to hold fixed during training.

init_nn_weights_path: objectΒΆ

None

frozen_parameters: list[str]ΒΆ

β€˜field(…)’

classmethod from_dict(raw)ΒΆ
validate()ΒΆ