mixins

Classes

ModelPipelineParamsToTuneMixin()

Mixin for pipelines with model inside with implementation of params_to_tune method.

ModelPipelinePredictMixin()

Mixin for pipelines with model inside with implementation of _predict method.

SaveModelPipelineMixin()

Implementation of AbstractSaveable abstract class for pipelines with model inside.

class ModelPipelineParamsToTuneMixin[source]

Mixin for pipelines with model inside with implementation of params_to_tune method.

params_to_tune() Dict[str, etna.distributions.distributions.BaseDistribution][source]

Get hyperparameter grid to tune.

Parameters for model has prefix “model.”, e.g. “model.alpha”.

Parameters for transforms has prefix “transforms.idx.”, e.g. “transforms.0.mode”.

Returns

Grid with parameters from model and transforms.

Return type

Dict[str, etna.distributions.distributions.BaseDistribution]

class ModelPipelinePredictMixin[source]

Mixin for pipelines with model inside with implementation of _predict method.

class SaveModelPipelineMixin[source]

Implementation of AbstractSaveable abstract class for pipelines with model inside.

It saves object to the zip archive with 4 entities:

  • metadata.json: contains library version and class name.

  • object.pkl: pickled without model, transforms and ts.

  • model.zip: saved model.

  • transforms: folder with saved transforms.

classmethod load(path: pathlib.Path, ts: Optional[etna.datasets.tsdataset.TSDataset] = None) typing_extensions.Self[source]

Load an object.

Warning

This method uses dill module which is not secure. It is possible to construct malicious data which will execute arbitrary code during loading. Never load data that could have come from an untrusted source, or that could have been tampered with.

Parameters
Returns

Loaded object.

Return type

typing_extensions.Self

save(path: pathlib.Path)[source]

Save the object.

Parameters

path (pathlib.Path) – Path to save object to.