Skip to content

model

SupportsPredict

Bases: Protocol

Protocol describing an object that has a predict method.

SciKitModel(estimator, *, output_names, name=None)

Bases: Model

A model that wraps a scikit-learn model.

Initialize the model.

Parameters:

Name Type Description Default
estimator SupportsPredict

The scikit-learn estimator.

required
output_names Iterable[str]

The names of the output columns.

required
name str | None

The name of the model.

None
Source code in src/flowcean/sklearn/model.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def __init__(
    self,
    estimator: SupportsPredict,
    *,
    output_names: Iterable[str],
    name: str | None = None,
) -> None:
    """Initialize the model.

    Args:
        estimator: The scikit-learn estimator.
        output_names: The names of the output columns.
        name: The name of the model.
    """
    if name is None:
        name = estimator.__class__.__name__
    self._name = name
    self.estimator = estimator
    self.output_names = list(output_names)