State

The State dataclass tracks the complete state of an active learning task, including the current round number, acquired candidates, training data, validation data, and all relevant metadata for resuming or analyzing experiments.

class alf_core.dataclasses.state.State(dataset, surrogate, round=0, acq_batch_size=0, history=<factory>, round_metrics=<factory>, metrics_history=<factory>, round_predictions=None)[source]

Bases: object

Tracks the state of a task.

dataset

The dataset containing train/validation/test splits and candidate pool.

surrogate

The surrogate model used for predictions.

round

Current round number in the active learning loop.

acq_batch_size

Number of candidates to acquire per round.

history

List of LabelledCandidates acquired in each round.

round_metrics

RoundMetrics instance holding scalar metrics and per-epoch training history for the current round.

metrics_history

RoundMetrics for every round run so far, in order.

round_predictions

Predictions on the test set for the current round.

acq_batch_size: int = 0
dataset: BaseDataset
history: list
metrics_history: list[RoundMetrics]
property problem_type: ProblemType

The problem type, as declared in the dataset configuration.

Returns:

ProblemType enum value from the dataset config.

round: int = 0
round_metrics: RoundMetrics
round_predictions: Predictions | None = None
surrogate: Surrogate
update(acquired_candidates)[source]

Update the state with newly acquired candidates.

Records the current round’s metrics in metrics_history, adds the acquired candidates to history and updates the dataset splits. Also increments the round counter.

Parameters:

acquired_candidates (LabelledCandidates) – The newly acquired candidates with their labels.

Return type:

None