Skip to content

learner

SupervisedLearner

Bases: ABC

Base class for supervised learners.

A supervised learner learns from input-output pairs.

learn(inputs, outputs) abstractmethod

Learn from the data.

Parameters:

Name Type Description Default
inputs DataFrame

The input data.

required
outputs DataFrame

The output data.

required

Returns:

Type Description
Model

The model learned from the data.

Source code in src/flowcean/core/learner.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
@abstractmethod
def learn(
    self,
    inputs: pl.DataFrame,
    outputs: pl.DataFrame,
) -> Model:
    """Learn from the data.

    Args:
        inputs: The input data.
        outputs: The output data.

    Returns:
        The model learned from the data.
    """

SupervisedIncrementalLearner

Bases: ABC

Base class for incremental supervised learners.

An incremental supervised learner learns from input-output pairs incrementally.

learn_incremental(inputs, outputs) abstractmethod

Learn from the data incrementally.

Parameters:

Name Type Description Default
inputs DataFrame

The input data.

required
outputs DataFrame

The output data.

required

Returns:

Type Description
Model

The model learned from the data.

Source code in src/flowcean/core/learner.py
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@abstractmethod
def learn_incremental(
    self,
    inputs: pl.DataFrame,
    outputs: pl.DataFrame,
) -> Model:
    """Learn from the data incrementally.

    Args:
        inputs: The input data.
        outputs: The output data.

    Returns:
        The model learned from the data.
    """

ActiveLearner

Bases: ABC

Base class for active learners.

Active learners require actions to be taken to learn.

learn_active(action, observation) abstractmethod

Learn from actions and observations.

Parameters:

Name Type Description Default
action DataFrame

The action performed.

required
observation DataFrame

The observation of the environment.

required

Returns:

Type Description
Model

The model learned from the data.

Source code in src/flowcean/core/learner.py
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@abstractmethod
def learn_active(
    self,
    action: pl.DataFrame,
    observation: pl.DataFrame,
) -> Model:
    """Learn from actions and observations.

    Args:
        action: The action performed.
        observation: The observation of the environment.

    Returns:
        The model learned from the data.
    """

propose_action(observation) abstractmethod

Propose an action based on an observation.

Parameters:

Name Type Description Default
observation DataFrame

The observation of an environment.

required

Returns:

Type Description
DataFrame

The action to perform.

Source code in src/flowcean/core/learner.py
77
78
79
80
81
82
83
84
85
86
@abstractmethod
def propose_action(self, observation: pl.DataFrame) -> pl.DataFrame:
    """Propose an action based on an observation.

    Args:
        observation: The observation of an environment.

    Returns:
        The action to perform.
    """