anchora
A thin, leakage-conscious bridge between polars time-series data and torch/JAX models.
The library owns data semantics — alignment, target construction, splits, the tensor boundary, and getting column names back at the end. You own the model and the training loop entirely. The single invariant everything is organized around:
Every row is an anchor:
tis the moment the prediction is made. Features at anchortmay only use information from≤ t; targets at anchortrefer to information from> t.
Quick tour
from datetime import date
import anchora as ac
# Long-format canonical storage; wide frames are derived views.
frame = ac.TimeFrame.from_wide(df, time="time", freq="1d")
# The only source of date boundaries. Splits are by anchor (prediction) date.
split = ac.TimeSplit(train_end=date(2023, 1, 1), val_end=date(2024, 1, 1))
# Targets are declared compositions of invertible steps.
target = ac.chain(
ac.horizon(5), # y(t+5), aligned to anchor t
ac.delta(baseline="persistence"), # subtract y(t); inverse adds it back
ac.scale("standard"), # fitted strictly on the train part
)
built = target.build(frame, variables=["groundwater_level"], split=split)
# Feature engineering stays free-form polars, contract-checked at the boundary.
@ac.feature_fn
def make_features(wide: pl.DataFrame) -> pl.DataFrame:
return wide.with_columns(pl.col("groundwater_level").shift(3).alias("groundwater lag3"))
features = make_features(frame.wide())
# The tensor boundary: numpy core, thin torch/JAX emitters, identity travels.
m = ac.Matrix(features, built, split, seq_len=30)
for x, y, idx in m.to_torch("train", batch_size=64):
...
# Model output back to a named, raw-space polars frame in one call.
preds = m.wrap_predictions(model_output, part="val")
m.worst(preds, k=5) # ranked worst instances
m.inspect(date(2023, 6, 1)) # lookback window + target for one anchor
Install
uv add anchora # core: polars + numpy
uv add anchora[torch] # torch emitter
uv add anchora[jax] # jax emitter
Documentation and examples
Concept docs live in docs/ (anchor convention, target
chains, the tensor boundary, contracts). Runnable examples with visual checks
live in examples/ — the first three are pure
numpy/polars/matplotlib, the last two add the framework emitters:
uv run examples/01_frame_and_alignment.py # the alignment convention, visually
uv run examples/02_target_chains.py # chain stages + exact round trip
uv run examples/03_linear_model.py # full loop with closed-form ridge
uv run examples/04_torch_lstm.py # LSTM via to_torch (anchora[torch])
uv run examples/05_jax_mlp.py # MLP via to_jax (anchora[jax])
uv run examples/06_forecast_value.py # skill vs pseudo-forecast quality
Design
The founding design spec lives in the JAXifer-harness repository
(docs/superpowers/specs/2026-07-08-anchora-design.md). Deliberately deferred:
the empirical leakage fuzzer (the @feature_fn registry is its replay seam)
and a general fit-window transform protocol (the scale target step is its
prototype).
Metadata
Release files for anchora-simlab 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| anchora_simlab-0.1.0.tar.gz | 37.1 kB | With provenance | Details for anchora_simlab-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anchora_simlab-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for anchora_simlab-0.1.0-py3-none-any.whl |
Total release size: 57.6 kB
Release files / anchora_simlab-0.1.0.tar.gz
| Download URL | anchora_simlab-0.1.0.tar.gz |
|---|---|
| Size | 37.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eaab834c8c611d3fbba5de56b95327d17c5c9e2137aa15d07052066061cc4d6d
|
|
BLAKE2b-256 checksum How to use checksums |
a7e5c8f7027370af89bcaff7268a626092100ed9d4fe161779e84e1f54cee90f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 12, 2026.
Transparency logRelease files / anchora_simlab-0.1.0-py3-none-any.whl
| Download URL | anchora_simlab-0.1.0-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
770ddee9d45eb7c82b82a7890df8be06b946a85b3aa83b0949edb025f1344d7a
|
|
BLAKE2b-256 checksum How to use checksums |
c0ad828a04fa3a32510cd3d16c5a0d4c7d4303c4e42662b9582049169ee612eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 12, 2026.
Transparency logSecurity for anchora-simlab 0.1.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.
Attestation for anchora_simlab-0.1.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 Jul 12, 2026.
Transparency logA 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.