dalheimdall
Python port of the R heimdall package — Drift Adaptable Models.
dalheimdall extends the DAL Experiment Line (pydaltoolbox) to streaming data and
non-stationary environments, providing a unified API for concept drift detection,
reactive retraining, recurrent concept pools, and controlled drift benchmarking.
Installation
pip install dalheimdall
For local development:
pip install -e ".[dev]"
Quickstart
1. Concept Drift Detection
import dalheimdall as ph
data = ph.datasets.st_drift_examples()
stream = data["multivariate"]
detector = ph.DfrAdwin(target_feat="x1", delta=0.002)
detector.fit(stream)
print("Drift detected:", detector.drifted)
print(detector.drifter_output.tail())
2. Reactive Retraining (AdpRetrain)
import numpy as np
import pandas as pd
import pydaltoolbox as dal
import dalheimdall as ph
rng = np.random.default_rng(42)
x = rng.normal(0, 1, size=(200, 2))
y = (x[:, 0] > 0).astype(int)
y[100:] = (x[100:, 0] <= 0).astype(int) # abrupt concept flip
df = pd.DataFrame({"x1": x[:, 0], "x2": x[:, 1], "y": y.astype(str)})
workflow = ph.AdpRetrain(
model=dal.ClaDtree("y", slevels=["0", "1"], random_state=42),
drift_method=ph.DfrDdm(min_instances=20),
warmup_size=40,
)
for start in range(0, len(df), 40):
batch = df.iloc[start : start + 40]
workflow.fit(batch[["x1", "x2"]], batch[["y"]])
print("Drift detected on last batch:", workflow.drifted)
3. Recurrent Concept Pools (AdpRecurrent)
import pydaltoolbox as dal
import dalheimdall as ph
workflow = ph.recurrent_ensemble(
method=dal.ClaDtree("y", slevels=["0", "1"], random_state=42),
train_size=40,
numerical_cols=["x1", "x2"],
detector=ph.DfrAdwin(target_feat="x1"),
memory=ph.MemoryBasic(),
)
What's Included
Every detector inherits from Drifter (ErrorBased, DistBased, or MvDistBased),
supporting streaming update_state(value) -> bool, batch fit(data) -> self
(populating drifter_output), and reset_state().
| Group | Classes & Functions |
|---|---|
| Core & Infrastructure | Drifter, Dummy, DfrInactive, DfrPassive, ErrorBased, DistBased, MvDistBased, DfrMultiCriteria, DriftWorkflow, drift_step, OneHot, TransPipeline, NrmBase, NrmMemory, MemoryManager, MemoryBasic, MemoryOversampling, MemoryUndersampling |
| Metrics | Metric, MtAccuracy, MtPrecision, MtRecall, MtFscore, MtRocauc, cm_metrics, f1_aggregate |
| Error-Based Detectors | DfrDdm, DfrEddm, DfrHddm, DfrEcdd, DfrCusum |
| Univariate Distribution Detectors | DfrAdwin, DfrPageHinkley, DfrKswin, DfrLbdd, DfrMcdd, DfrPsi, DfrOnlinebcp, DfrFastlr, DfrGreedyks, DfrIks, DfrQts, psi, online_bcp, fastlr_split, ks_sf, GreedyKS, iks_ca, IKS |
| Multivariate & Structural Detectors | DfrKldist, DfrAedd, DfrCosine, DfrEikmeans, DfrMmqt, DfrDde, DfrLlr2, cosine_score, eikmeans, eikmeans_test, mmqt, mmqt_test, dde_curve, dde_score, dde_feature_drift, spbn, spbn_loglik |
| Ensemble, OOD & Student-Teacher | DfrStudd, DfrProton, DfrEnsemble, ensemble_vote |
| Neural & Deep CPD Detectors | DfrPadd, DfrMcd, DfrIndid, DfrWwAggr, indid, indid_predict, tscp2, ts2vec, cpd_scores, cpd_calibrate, cpd_ensemble, cpd_ensemble_fit, wwaggr |
| Adaptive Workflows | AdpRetrain, AdpRecurrent, adapt_static, adapt_retrain, adapt_incremental, adapt_reset, recurrent_ensemble, recurrent_incremental, Concept, ConceptPool, ConceptPoolInactive, TrainStatic, TrainRetrain, TrainIncremental, SlctInactive, SlctPsi, SlctErrorMetrics, SlctPsiThenBest, SlctPsiThenError, SlctAe, EvtLeastUsed, EvtRedundant, RankRatio, RankPsi, RareKeep, RareDrop, RecAlways, RecStable, LearnedLimit |
| Benchmarks & Datasets | datasets.st_drift_examples(), dsg_source, dsg_take, dsg_drift, dsg_stream, dsg_mmd_test, dsg_source_data, dsg_source_regions, dsg_sea, dsg_sine, dsg_mixed, dsg_agrawal |
Examples
Rendered examples live in examples/README.md and are generated from
executable Markdown notebooks under notebooks/ via:
python notebooks/conversor.py
Related DAL Projects
- pydaltoolbox — Experiment Line foundations (Python)
- heimdall — R original
- Data Analytics Lab
License
MIT
Metadata
Release files for dalheimdall 1.0.707
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 |
|---|---|---|---|---|
| dalheimdall-1.0.707.tar.gz | 129.0 kB | Without provenance | Details for dalheimdall-1.0.707.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dalheimdall-1.0.707-py3-none-any.whl | Python 3 | none | any | Details for dalheimdall-1.0.707-py3-none-any.whl |
Total release size: 274.1 kB
Release files / dalheimdall-1.0.707.tar.gz
| Download URL | dalheimdall-1.0.707.tar.gz |
|---|---|
| Size | 129.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2699ed41365b83cf63b7b45191cdbad5f89e2cb1f8cb80d969dba0faee00372e
|
|
BLAKE2b-256 checksum How to use checksums |
797f29c31f117a7e5a9a588716f442e9f4a1aca90c9ac3a2fecce4c591f825ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.0
|
Release files / dalheimdall-1.0.707-py3-none-any.whl
| Download URL | dalheimdall-1.0.707-py3-none-any.whl |
|---|---|
| Size | 145.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5172880de4d6f423a70d28701ae93cb743ec44e15457dcead60aeea48fd12907
|
|
BLAKE2b-256 checksum How to use checksums |
488648ce2223558aaa0c7099fef641409cef5d2138bb0317cc8063ffb5d1dfa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.0
|
Security for dalheimdall 1.0.707
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.