Skip to content

sklearn

Accuracy

Bases: OfflineMetric

Accuracy classification score.

As defined by scikit-learn.

ClassificationReport

Bases: OfflineMetric

Build a text report showing the main classification metrics.

As defined by scikit-learn.

FBetaScore(beta=1.0)

Bases: OfflineMetric

F-beta score.

As defined by scikit-learn.

Initialize the metric.

Parameters:

Name Type Description Default
beta float

The beta parameter.

1.0
Source code in src/flowcean/sklearn/metrics/classification.py
44
45
46
47
48
49
50
def __init__(self, beta: float = 1.0) -> None:
    """Initialize the metric.

    Args:
        beta: The beta parameter.
    """
    self.beta = beta

PrecisionScore

Bases: OfflineMetric

Precision classification score.

As defined by scikit-learn.

Recall

Bases: OfflineMetric

Recall classification score.

As defined by scikit-learn.

MaxError

Bases: OfflineMetric

Max error regression loss.

As defined by scikit-learn.

MeanAbsoluteError

Bases: OfflineMetric

Mean absolute error (MAE) regression loss.

As defined by scikit-learn.

MeanSquaredError

Bases: OfflineMetric

Mean squared error (MSE) regression loss.

As defined by scikit-learn.

R2Score

Bases: OfflineMetric

R^2 (coefficient of determination) regression score.

As defined by scikit-learn.

SciKitModel(model, output_name)

Bases: Model

A model that wraps a scikit-learn model.

Initialize the model.

Parameters:

Name Type Description Default
model Any

The scikit-learn model.

required
output_name str

The name of the output column.

required
Source code in src/flowcean/sklearn/model.py
16
17
18
19
20
21
22
23
24
25
26
27
28
def __init__(
    self,
    model: Any,
    output_name: str,
) -> None:
    """Initialize the model.

    Args:
        model: The scikit-learn model.
        output_name: The name of the output column.
    """
    self.model = model
    self.output_name = output_name

RegressionTree(*args, dot_graph_export_path=None, **kwargs)

Bases: SupervisedLearner

Wrapper class for sklearn's DecisionTreeRegressor.

Reference: https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeRegressor.html

Initialize the regression tree learner.

Parameters:

Name Type Description Default
*args Any

Positional arguments to pass to the DecisionTreeRegressor.

()
dot_graph_export_path None | str

Path to export the decision tree graph to.

None
**kwargs Any

Keyword arguments to pass to the DecisionTreeRegressor.

{}
Source code in src/flowcean/sklearn/regression_tree.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def __init__(
    self,
    *args: Any,
    dot_graph_export_path: None | str = None,
    **kwargs: Any,
) -> None:
    """Initialize the regression tree learner.

    Args:
        *args: Positional arguments to pass to the DecisionTreeRegressor.
        dot_graph_export_path: Path to export the decision tree graph to.
        **kwargs: Keyword arguments to pass to the DecisionTreeRegressor.
    """
    self.regressor = DecisionTreeRegressor(
        *args,
        **kwargs,
        random_state=get_seed(),
    )
    self.dot_graph_export_path = dot_graph_export_path