ertk.pytorch.models.PyTorchModelConfig

class ertk.pytorch.models.PyTorchModelConfig(optimiser: str = 'adam', opt_params: dict[str, typing.Any] = <factory>, learning_rate: float = 0.001, n_features: int = -1, n_classes: int = -1, loss: str = 'cross_entropy', loss_args: dict[str, typing.Any] = <factory>)

Bases: ERTKConfig

Base class for PyTorch model configuration dataclasses.

__init__(optimiser: str = 'adam', opt_params: dict[str, typing.Any] = <factory>, learning_rate: float = 0.001, n_features: int = -1, n_classes: int = -1, loss: str = 'cross_entropy', loss_args: dict[str, typing.Any] = <factory>) None

Methods

__init__([optimiser, opt_params, ...])

Inherited Methods

default()

Create default config.

from_config(config)

Create config object from any compatible config.

from_file(path)

Create config from YAML file and optionlly override some values.

merge_with_args(args)

Merge config with command-line arguments.

merge_with_config(config)

Merge other config into this config.

to_dictconfig()

Convert config to DictConfig.

to_file(path)

Write config to YAML file.

to_string()

Generate YAML string representation of config.

Attributes

learning_rate

The learning rate to use.

loss

The loss function to use.

n_classes

The number of classes in the output data.

n_features

The number of features in the input data.

optimiser

The optimiser to use.

opt_params

Parameters to pass to the optimiser.

loss_args

Arguments to pass to the loss function.

learning_rate: float = 0.001

The learning rate to use.

loss: str = 'cross_entropy'

The loss function to use.

loss_args: dict[str, Any]

Arguments to pass to the loss function.

n_classes: int = -1

The number of classes in the output data.

n_features: int = -1

The number of features in the input data.

opt_params: dict[str, Any]

Parameters to pass to the optimiser.

optimiser: str = 'adam'

The optimiser to use.