peal.architectures.interfaces.TaskConfig

class peal.architectures.interfaces.TaskConfig[source]

Bases: BaseModel

A dict of critirion names (that have to be implemented in peal.training.criterions) mapped to the weight. Like this the loss function can be post_hoc attached without changing the code.

Methods

Attributes

bce_mse_mix

The mix between binary cross entropy loss and mse loss.

class_restriction

Gives the option to only use samples from one or more specified classes

config_name

The type of config.

criterions

The criterions used for training the model.

focal_alpha

The alpha parameter of the focal loss.

focal_gamma

The gamma parameter of the focal loss.

focal_mse_mix

The mix between focal loss and mse loss.

mixed_bce_pos_weight

The pos_weight parameter of the BCEWithLogitsLoss used for mixed BCE and MSE loss.

output_channels

The output_channels that can be at most the output_channels of the dataset, but if a subtask is chosen the output_channels has also be adapted accordingly

output_type

The output_type that either can just be the output_type of the dataset or could be some possible subtype.

x_selection

Gives the option to select a subset of the input variables.

y_selection

Gives the option to select a subset of the output_variables.

config_name: str = 'TaskConfig'

The type of config. This is necessary to find config class from yaml config

criterions: dict = {'ce': 1.0, 'l2': 100.0}

The criterions used for training the model.

focal_alpha: float = 0.25

The alpha parameter of the focal loss.

focal_gamma: float = 1.0

The gamma parameter of the focal loss.

focal_mse_mix: float = 1.0

The mix between focal loss and mse loss.

mixed_bce_pos_weight: float = 1.0

The pos_weight parameter of the BCEWithLogitsLoss used for mixed BCE and MSE loss.

bce_mse_mix: float = 1.0

The mix between binary cross entropy loss and mse loss.

output_type: str = 'singleclass'

The output_type that either can just be the output_type of the dataset or could be some possible subtype. E.g. when having a binary multiclass dataset one could use as task binary single class classification for one of the output variables.

output_channels: pydantic.PositiveInt = 2

The output_channels that can be at most the output_channels of the dataset, but if a subtask is chosen the output_channels has also be adapted accordingly

x_selection: list[str] | None = None

Gives the option to select a subset of the input variables. Only works for symbolic data.

y_selection: list[str] | None = None

Gives the option to select a subset of the output_variables. Can be used e.g. to transform binary multiclass into the subtask of predicting one of the binary variables with single class classification.

class_restriction: int | list[int] | None = None

Gives the option to only use samples from one or more specified classes