strategies
StopLearning
Bases: Exception
Stop learning.
This exception is raised when the learning process should stop.
learn_active(environment, learner)
Learn from an active environment.
Learn from an active environment by interacting with it and learning from the observations. The learning process stops when the environment ends or when the learner requests to stop.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
environment
|
ActiveEnvironment
|
The active environment. |
required |
learner
|
ActiveLearner
|
The active learner. |
required |
Returns:
Type | Description |
---|---|
Model
|
The model learned from the environment. |
Source code in src/flowcean/core/strategies/active.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
learn_incremental(environment, learner, inputs, outputs, input_transform=None, output_transform=None)
Learn from a incremental environment.
Learn from a incremental environment by incrementally learning from the input-output pairs. The learning process stops when the environment ends.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
environment
|
IncrementalEnvironment
|
The incremental environment. |
required |
learner
|
SupervisedIncrementalLearner
|
The supervised incremental learner. |
required |
inputs
|
list[str]
|
The input feature names. |
required |
outputs
|
list[str]
|
The output feature names. |
required |
input_transform
|
Transform | None
|
The transform to apply to the input features. |
None
|
output_transform
|
Transform | None
|
The transform to apply to the output features. Its inverse will be part of the final model. |
None
|
Returns:
Type | Description |
---|---|
Model
|
The model learned from the environment. |
Source code in src/flowcean/core/strategies/incremental.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
evaluate_offline(model, environment, inputs, outputs, metrics)
Evaluate a model on an offline environment.
Evaluate a model on an offline environment by predicting the outputs from the inputs and comparing them to the true outputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Model
|
The model to evaluate. |
required |
environment
|
OfflineEnvironment
|
The offline environment. |
required |
inputs
|
list[str]
|
The input feature names. |
required |
outputs
|
list[str]
|
The output feature names. |
required |
metrics
|
list[OfflineMetric]
|
The metrics to evaluate the model with. |
required |
Returns:
Type | Description |
---|---|
Report
|
The evaluation report. |
Source code in src/flowcean/core/strategies/offline.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
learn_offline(environment, learner, inputs, outputs, *, input_transform=None, output_transform=None)
Learn from an offline environment.
Learn from an offline environment by learning from the input-output pairs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
environment
|
OfflineEnvironment
|
The offline environment. |
required |
learner
|
SupervisedLearner
|
The supervised learner. |
required |
inputs
|
list[str]
|
The input feature names. |
required |
outputs
|
list[str]
|
The output feature names. |
required |
input_transform
|
Transform | None
|
The transform to apply to the input features. Will be part of the final model. |
None
|
output_transform
|
Transform | None
|
The transform to apply to the output features. Its inverse will be part of the final model. |
None
|
Returns:
Type | Description |
---|---|
Model
|
The model learned from the environment. |
Source code in src/flowcean/core/strategies/offline.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|