Skip to content

aalpy

Native AALpy backends for passive deterministic automata learning.

RPNIMealyLearner

Bases: SupervisedLearner

Learn a Mealy machine from full input/output traces using AALpy RPNI.

Inputs and outputs must each select exactly one list column, with one trace per row. Lists contain ordered scalar symbols (strings, booleans, integers, or finite floats). Nulls are not supported. Input and output words must have equal lengths.

Prefix expansion is handled internally. Contradictory traces are rejected. AALpy's default input-incomplete learning is retained: prediction raises ValueError for undefined transitions rather than inventing outputs.

RPNIMooreLearner

Bases: SupervisedLearner

Learn a Moore machine, including its initial-state output.

Accepts the same ordered scalar-word representation as RPNIMealyLearner, but every output word must contain exactly one more symbol than its input word. The first output labels the initial state; subsequent outputs label states reached after each input. In particular, an empty input word requires one output symbol.

Prediction returns symbol lists including the initial output. Undefined transitions raise ValueError; input completion is not enabled.

RPNIMealyModel(automaton, *, input_name, input_type, output_name, output_type)

Bases: _RPNIModel[MealyMachine]

A Flowcean model wrapping an AALpy Mealy machine by composition.

Predictions require the training input column's name and scalar dtype. They have the training output column's name and scalar dtype, with one list of output symbols per input trace. An empty input word produces an empty output word. Undefined transitions raise ValueError; no completion is invented.

Source code in src/flowcean/aalpy/model.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
def __init__(
    self,
    automaton: Automaton,
    *,
    input_name: str,
    input_type: pl.DataType,
    output_name: str,
    output_type: pl.DataType,
) -> None:
    self._automaton = automaton
    self._input_name = input_name
    self._input_type = input_type
    self._output_name = output_name
    self._output_type = output_type

RPNIMooreModel(automaton, *, input_name, input_type, output_name, output_type)

Bases: _RPNIModel[MooreMachine]

A Flowcean model wrapping an AALpy Moore machine by composition.

Predictions require the training input column's name and scalar dtype. They have the training output column's name and scalar dtype, with one list of output symbols per input trace. Every output word starts with the initial-state output, even for empty input words. Undefined transitions raise ValueError.

Source code in src/flowcean/aalpy/model.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
def __init__(
    self,
    automaton: Automaton,
    *,
    input_name: str,
    input_type: pl.DataType,
    output_name: str,
    output_type: pl.DataType,
) -> None:
    self._automaton = automaton
    self._input_name = input_name
    self._input_type = input_type
    self._output_name = output_name
    self._output_type = output_type