phlower.settings.NoiseSetting¶
- class phlower.settings.NoiseSetting(*, input_variable, increment_variable, std, mask=None, fraction=None)[source]¶
Bases:
BaseModelGaussian noise added to an input during training.
The same noise is subtracted from the label which is the increment of the input, so that the model learns to correct the noise.
The data is rescaled with the std s’ of the noisy data. With s the std of the clean data fitted at preprocessing (of the input or of the increment respectively), std the std of the noise, fraction the fraction of the nodes receiving noise (fraction of ones in mask): s’ = sqrt(s^2 + std^2 * fraction) and r = s / s’, the model sees r * (scaled input + noise / s) and the label r * (scaled increment - noise / s). At prediction, the input is r * scaled input and the output is divided by r before the inverse scaling.
With linear scalers other than standardize and std_scale, s is the scale of the scaler and r = 1. Nonlinear scalers are not supported.
Methods
Attributes
model_computed_fieldsConfiguration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
model_extraGet extra fields set during validation.
model_fieldsmodel_fields_setReturns the set of fields that have been explicitly set on this model instance.
Name of the input of the model to add the noise to.
Name of the label of the model which is the increment of input_variable.
Standard deviation of the noise, in the unit of the unscaled data.
Name of a variable of shape (n_nodes, 1), set in model.fields, which is 1 on the nodes receiving noise and 0 elsewhere.
Fraction of the nodes receiving noise (mask 1) in the training data.
- Parameters:
input_variable (str)
increment_variable (str)
std (Annotated[float, Gt(gt=0)])
mask (str | None)
fraction (Annotated[float | None, Ge(ge=0.0), Le(le=1.0)])
- fraction: float | None¶
Fraction of the nodes receiving noise (mask 1) in the training data. Always computed and overwritten by the trainer, so a value set by the user is ignored. It is written in the saved setting, so that the predictor can recompute r.
- increment_variable: str¶
Name of the label of the model which is the increment of input_variable.
- input_variable: str¶
Name of the input of the model to add the noise to.
- mask: str | None¶
Name of a variable of shape (n_nodes, 1), set in model.fields, which is 1 on the nodes receiving noise and 0 elsewhere.
- model_config = {'extra': 'forbid', 'frozen': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- std: float¶
Standard deviation of the noise, in the unit of the unscaled data.