Skip to content

base

Environment

Bases: Named, Protocol

Abstraction for data sources in learning and evaluation.

An environment describes the possible data sources for the learning and evaluation procedure. Environments can be offline (pre-recorded datasets), incremental (streaming data), or active (interactive systems where the learner can influence the environment). All environments support applying transforms to observations.

append_transform(transform)

Append a transform to the observation.

Parameters:

Name Type Description Default
transform Transform

Transform to append.

required

Returns:

Type Description
Self

This observable with the appended transform.

Source code in src/flowcean/core/environment/base.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def append_transform(
    self,
    transform: Transform,
) -> Self:
    """Append a transform to the observation.

    Args:
        transform: Transform to append.

    Returns:
        This observable with the appended transform.
    """
    self.transform = self.transform.chain(transform)
    return self

observe()

Observe and return the observation.

Source code in src/flowcean/core/environment/base.py
53
54
55
def observe(self) -> Data:
    """Observe and return the observation."""
    return self.transform(self._observe())

__or__(transform)

Shortcut for with_transform.

Source code in src/flowcean/core/environment/base.py
57
58
59
60
61
62
63
@final
def __or__(
    self,
    transform: Transform,
) -> Self:
    """Shortcut for `with_transform`."""
    return self.append_transform(transform)