lenskit.pipeline.Configurable#

class lenskit.pipeline.Configurable(*args, **kwargs)#

Bases: Protocol

Interface for configurable objects such as pipeline components with settings or hyperparameters. A configurable object supports two operations:

  • saving its configuration with get_config().

  • creating a new instance from a saved configuration with the class method from_config().

An object must implement both of these methods to be considered configurable. Components extending the Component automatically have working versions of these methods if they define their constructor parameters and fields appropriately.

Note

Configuration data should be JSON-compatible (strings, numbers, etc.).

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

from_config(cfg)

Reinstantiate this component from configuration values.

get_config()

Get this component's configured hyperparameters.

classmethod from_config(cfg)#

Reinstantiate this component from configuration values.

Parameters:

cfg (dict[str, Any])

Return type:

Self

get_config()#

Get this component’s configured hyperparameters.

Return type:

dict[str, object]