Skip to main content

fishladder

CI PyPI License DOI

Fishladder Banner

An evaluation framework for online multi-output active learning on data streams.

fishladder is in alpha: the API may still change between minor versions.

What is this?

In many streaming applications (soft sensors, process monitoring, environmental sensing), each instance arrives with several outputs to predict, and obtaining the true values is expensive. An active learner has to decide, on the fly, which labels are worth asking for, and for which outputs. Those labels often come back late, and each output can have its own delay.

Existing stream-learning libraries support active learning only for single-output classification, and existing active learning libraries mostly assume a pool of data rather than a stream. fishladder fills the gap by providing tools to evaluate active learning methods in this setting. Like a fish ladder lets only some fish past a dam, the goal is to study which labels are worth letting through.

fishladder follows River's conventions (dictionaries for x and y, predict_one and learn_one, River-style metrics) and works with River's multi-output models, datasets and metrics out of the box. It complements River rather than replacing it.

Features

  • Output-level querying. Ask for any subset of the outputs of an instance, with a cost per output.
  • Query strategies, budgets and models are separate pieces. Any strategy can be combined with any budget and any model.
    • Strategies (fl.strategy): RandomPerOutput, QueryAll, QueryByCommittee and ExpectedError.
    • Budgets (fl.budget), measured in cost rather than in number of queries: TotalBudget, RateBudget, Unlimited, PerOutput to give each output its own share, and VariableThreshold to only query outputs whose utility is high compared to their recent ones, optionally with a randomized threshold.
  • Randomized querying, which makes active learning more robust to drift. fl.strategy.Split mixes any strategy with random exploration, and fl.strategy.Randomized turns any strategy's utilities into query probabilities, so that new randomized strategies only define how. The probabilities are kept in the log.
  • Prequential evaluation (fl.evaluate). Test-then-train, with predictions scored on every output, queried or not.
  • Delayed labels. A delay per output, constant or drawn at random, and labels that never arrive. Queries are paid for when they are made, and labels are learned when they arrive.
  • Learning from unlabelled instances. With learn_unsupervised=True, the unsupervised steps of the model's River pipelines, such as a scaler, learn from every instance, queried or not, as with River's learn_during_predict but for this model only. Models and strategies can define a learn_unsupervised(x) method to do the same. The River models inside strategies, as in QueryByCommittee, are not updated. Models that do not predict each instance once, such as River chains, learn from some instances more than once, and River chains and model selectors raise a warning.
  • A tidy experiment log (fl.Log), with one row per instance and output, from which per-output and averaged metrics, learning curves indexed by cost, and areas under them are computed (fl.metrics), including the relative RMSE (fl.metrics.RRMSE) and its average over outputs (aRRMSE).
  • A synthetic multi-target stream generator (fl.synth.MultiTarget), with control over the correlation between outputs, their noise and smoothness, and when each one drifts.
  • A River-style wrapper (fl.active.Wrapper) to add output-level active learning to an existing River application.

Installation

pip install "fishladder[river]"

The river extra installs River, which the examples use for models and metrics. fishladder itself only depends on NumPy and pandas. Add the plots extra for the notebooks.

Quickstart

from river import linear_model, metrics, multioutput, preprocessing

import fishladder as fl

costs = {"y0": 1.0, "y1": 2.0, "y2": 5.0}

log = fl.evaluate.prequential(
    dataset=fl.synth.MultiTarget(n_features=5, seed=42).take(2000),
    model=multioutput.RegressorChain(
        preprocessing.StandardScaler() | linear_model.LinearRegression(),
        order=list(costs),
    ),
    strategy=fl.strategy.RandomPerOutput(p=0.5, seed=42),
    budget=fl.budget.PerOutput(fl.budget.RateBudget(1.5)),
    costs=costs,
    delay={"y0": 0, "y1": 0, "y2": 100},  # y2's labels arrive 100 instances later
)

fl.metrics.per_output(log, metrics.MAE())
{'y0': MAE: 0.704636, 'y1': MAE: 0.526393, 'y2': MAE: 0.479729}

The log can be turned into a DataFrame with log.to_frame(), and fl.metrics.curve gives learning curves along the stream, against either the number of instances or the cost spent.

To add active learning to an existing River loop instead:

model = fl.active.Wrapper(model, strategy, budget, costs)

for x, y in dataset:
    y_pred, ask = model.predict_one(x)  # the outputs to ask for, paid for here
    if ask:
        model.learn_one(x, {o: y[o] for o in ask})

Notebooks

The notebooks show fishladder in use with River: a quickstart, the River wrapper, the query strategies, synthetic streams with drift, delayed labels, and randomized querying.

Contributing and feedback

Ideas, use cases and criticism are welcome through GitHub issues.

Citation

If you use fishladder in your research, please cite it with its DOI, which always points to the latest version. GitHub's "Cite this repository" button gives the reference in APA and BibTeX.

License

BSD 3-Clause. See LICENSE.

Metadata

Release files for fishladder 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fishladder 0.2.0
File Size Uploaded Provenance Actions
fishladder-0.2.0.tar.gz 47.6 kB With provenance Details for fishladder-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fishladder 0.2.0
File Interpreter ABI Platform Actions
fishladder-0.2.0-py3-none-any.whl Python 3 none any Details for fishladder-0.2.0-py3-none-any.whl

Total release size: 81.5 kB

Release files / fishladder-0.2.0.tar.gz

Download URL fishladder-0.2.0.tar.gz
Size 47.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f0505db9b83c5f754f0698af782cd59de033dfce62f935a9bfbda7a128823dd2
BLAKE2b-256 checksum
How to use checksums
3ae8ebd6d7a99bf9c5198c0b6d64ec5691b129b6e8a2941803295dee376acce6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / fishladder-0.2.0-py3-none-any.whl

Download URL fishladder-0.2.0-py3-none-any.whl
Size 33.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb1a7f41b225ba22b21e3215f7d31e8b5b0540294a62ed7b690690bf469da97e
BLAKE2b-256 checksum
How to use checksums
69e5133ce8d3c3659851f6846326fa32c1d396620dcba3055a751072d4dee707
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for fishladder 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fishladder-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page