vak.config.model.ModelConfig

class vak.config.model.ModelConfig(name: str, network: dict, optimizer: dict, loss: dict, metrics: dict)[source]

Bases: object

Class representing the model table of a toml configuration file.

name
Type:

str

network

Keyword arguments for the network class, or a dict of ``dict``s mapping network names to keyword arguments.

Type:

dict

optimizer

Keyword arguments for the optimizer class.

Type:

dict

loss

Keyword arguments for the class representing the loss function.

Type:

dict

metrics

A dict of ``dict``s mapping metric names to keyword arguments.

Type:

dict

__init__(name: str, network: dict, optimizer: dict, loss: dict, metrics: dict) None

Method generated by attrs for class ModelConfig.

Methods

__init__(name, network, optimizer, loss, metrics)

Method generated by attrs for class ModelConfig.

asdict()

Convert this ModelConfig instance to a dict that can be passed into functions that take a model_config argument, like vak.train() and vak.predict().

from_config_dict(config_dict)

Return ModelConfig instance from a dict.

Attributes

asdict()[source]

Convert this ModelConfig instance to a dict that can be passed into functions that take a model_config argument, like vak.train() and vak.predict().

classmethod from_config_dict(config_dict: dict)[source]

Return ModelConfig instance from a dict.

The dict passed in should be the one found by loading a valid configuration toml file with vak.config.parse.from_toml_path(), and then using a top-level table key, followed by key 'model'. E.g., config_dict['train']['model']` or ``config_dict['predict']['model'].

Examples

config_dict = vak.config.parse.from_toml_path(toml_path) model_config = vak.config.Model.from_config_dict(config_dict[‘train’])