activelearning.active_learning
Functions
|
Execute the active learning loop with budget constraints. |
Module Contents
- activelearning.active_learning.active_learning(
- dataset: Dataset,
- surrogate: Surrogate,
- acquisition: Acquisition,
- sampler: Sampler,
- selector: Selector,
- oracle: Oracle,
- budget: Budget,
- runtime_context: RuntimeContext | None = None,
- run_writer: RunWriter | None = None,
Execute the active learning loop with budget constraints.
Iteratively: (1) fits surrogate on current data, (2) samples candidates, (3) selects candidates to label, (4) queries oracle and adds observations. Stops when budget is exhausted or no affordable candidates remain.
- Parameters:
dataset (Dataset) – Dataset for storing and retrieving observations.
surrogate (Surrogate) – Surrogate model to fit on observations.
acquisition (Acquisition) – Acquisition function to score candidate utility. Must be compatible with the surrogate (see acquisition.update() docs).
sampler (Sampler) – Sampler to propose candidate subsets.
selector (Selector) – Selector to choose final candidates from sampled pool.
oracle (Oracle) – Oracle instance that handles all fidelity levels internally.
budget (Budget) – Budget object managing allocation and consumption.
runtime_context (RuntimeContext, optional) – Shared runtime settings propagated to runtime-aware components. If omitted, components fall back to the default context. If the context contains a logger, the loop records per-round metrics through it.
run_writer (RunWriter, optional) – Structured run logger used to persist run-start metadata, per-round artifacts, and the final run summary.
- Returns:
result –
- Tuple containing:
Updated dataset with new observations
Total cost incurred across all queries
Number of active learning rounds completed
- Return type:
tuple[Dataset, float, int]
Notes
The loop terminates early if no candidates can be afforded within the remaining budget to prevent infinite loops.