Repository navigation
Releases
v0.1.12
pyconformal 0.1.12
Highlights
- Tier 1 conformal methods (5 new pure-NumPy modules, PR #12):
ClusteredConformalClassifier(clustered.py; Ding et al., NeurIPS 2023)LocalizedConformalRegressor(localized.py; Hore & Barber, JRSS-B 2025 RLCP & Guan, Biometrika 2023 LCP)ConformalSelector(selection.py; Jin & Candès, JMLR 2023 — BH FDR control)ConformalSurvivalRegressor&kaplan_meier(survival.py; Candès, Lei & Ren, JRSS-B 2023)LabelShiftConformalClassifier&estimate_label_shift_weights(label_shift.py; Podkopaev & Ramdas, UAI 2021)
- Tier 2 conformal methods, score & conditional diagnostics (6 new pure-NumPy modules +
SOCOP+ WSC/ERT, PR #13):CopulaConformalRegressor&EllipsoidalConformalRegressor(multivariate.py)ConditionalConformalRegressor(conditional.py)ConformalEPredictor(evalues.py)ConformalDecisionControl&DecisionResult(decision.py)SOCOP(scores.py; Wang, Sun & Dobriban, ICLR 2026 — 5th classification score)ConformalITE(causal.py)ConformalLanguageFilter(llm.py;"all_factual"&"fdr"guarantees)worst_slab_coverage(WSC) &conditional_coverage_diagnostic(ERT) inpyconformal.evaluation
- Hot-path performance optimisations (PR #14):
ConformalLanguageFilter(guarantee="fdr"): 355× faster with Numba (97× pure NumPy) via exactO(N K log(N K))event-diff sweep-lineSOCOP&LAC: 48× faster (SOCOPparallel Numba kernels + zero-matrixlabel_scores)LocalizedConformalRegressor: 8.4× faster RLCP / 6.0× faster LCP via fused parallel Numba kernelestimate_label_shift_weights: 3.2× faster via zero-allocation BLASdgemvEM
- Documentation: 11 new runnable method pages, updated
docs/index.md,whats-inside.md(73 estimator classes, 5 scores, 101 public exports),api.md,llms.txt, andmkdocs.yml(53 nav pages).
Install: pip install "pyconformal[fast]" (or pip install pyconformal for NumPy-only).
Docs: https://valeman.github.io/pyconformal/
v0.1.11
Highlights
- Conformal Risk Control & Learn Then Test (
pyconformal.risk): Pure-NumPyConformalRiskControl(Angelopoulos et al., ICLR 2024) for exact finite-sample expected-risk control of bounded monotone losses in[0, B], andLearnThenTest(Angelopoulos et al., JACM 2025) for high-probability1 - deltasimultaneous control of arbitrary (including non-monotone) losses with exact log-space Binomial, Hoeffding, Bentkus, and Hoeffding–Bentkus p-values and Bonferroni, Holm, and Fixed-Sequence FWER control. - Conformal Object Detection (
pyconformal.detection): Zero-dependencyConformalObjectDetectoron(N, 4)[x1, y1, x2, y2]bounding boxes with exact finite-sample containment guarantees across four modes (additive,multiplicative,additive_coordinate,multiplicative_coordinate), safemin_sizeclamping, Mondriangroups=,clip_bounds=, andcontains/box_area/box_iouhelpers. - Conformal Anomaly Detection & Exchangeability Martingales (
pyconformal.anomaly):ConformalAnomalyDetector(exact & smoothed conformal p-values, Mondriangroups=, Benjamini–Hochberg conformal FDR control viabh_select) andConformalMartingale(Simple Jumper, Power, and Mixture online exchangeability test martingales in log-space with Ville's inequality all-time false-alarm control). - Production hardening & diagnostics: PEP 561
py.typedmarker; two-level_SortedBlocksinSortedWindow(2.3× faster atT=30,000); four pure-NumPy diagnostics inpyconformal.evaluation(size_stratified_coverage,rolling_coverage,reliability_curve,pit_calibration);sklearn.base.clonecompliance fix forDtACI/AgACI; fullpickle/deepcopy/clonetest suite across all public classes; CI fatal-errorrufflint job. - Documentation overhaul: 5-tab navigation, landing Grid Cards & Mermaid flowchart, exact total/per-category method counts (61 estimator classes, 85 public exports), reproducible pure-NumPy SVG comparison charts, KaTeX math rendering, standardised Guarantee callouts,
llms.txt, and two runnable Open-in-Colab quickstart notebooks.
Full changelog: CHANGELOG.md
v0.1.10
What's New in 0.1.10
- NumPy-only core with zero exceptions:
CQACPnow runs on pure NumPy (AS 241 normal quantile + exact active-set Cornish-Fisher solver, replacing SciPy SLSQP);HQRWACI(estimators="study")(scikit-learn) removed; AST test & NumPy-only CI gate enforce zero external dependencies outside NumPy, optional Numba, and optional adapters (QuantileBooster,LaplaceSkater). - Own fast point models (
pyconformal.point_models):Ridge,KNeighbors,ExtraTrees, andlinear_quantile_regression(1.4× to 61× faster than scikit-learn/statsmodels), plus new docs pages Core methods written from scratch and Point models. - Major speed-ups:
import pyconformal: 30× faster cold import (1.13 s → 37 ms via PEP 562 lazy loading)NonexchangeableConformalstepwise: 13.9× fasterNadarayaWatsonQuantileAIC fit: 12.6× fasterPanelPredictiveSystem: 8.1× faster (fused streaming Numba kernel)SplitConformalClassifiergrouped prediction &DriftOCP: 2.8× fasterSeasonalNaiveInterval: 2.3× faster with boundedO(season)memoryVennAbers: single-pass thread-safe hull kernel;ExtraTreesnode-array trimming;QuantileBoosterheld-out-only calibration inference
- Study parity opt-in (
study=True): Defaults follow the published methods (HQRWACI,AdaptiveEnbCQR,MarginalInterval), with exact study numbers preserved understudy=True. - Exact ranks, API consistency & edge-case hardening: Exact rational conformal ranks (
_rank) acrossMarginalInterval,HQRWACI,csp.py, andSPCI(conformalize=True, quantile="conformal"); consistentlower_marginssign (ResCP,CQACP) and(n, 2, A)layout (SplitConformalReference); atomiccalibrate(); hardenedonline.py,panel.py,evaluation.py,trackers.py,regimes.py,reservoir.py,online_quantile.py,univariate.py,forest.py, andpoint_models.py. - Documentation: Strict
--strictCI checks, tag-gated GitHub Pages deploys, deduplicatedapi.md, restored class docstrings, absolute PyPI README links, and corrected guides/FAQ.
Full details in CHANGELOG.md.
v0.1.9
New trackers in pyconformal.trackers: ECI (error-quantified conformal inference, Wu et al. 2025, with the study’s cutoff and integral variants, 32nd to 35th), DDCI (dynamic dual-feedback CI, Du, Luo and Aickelin, 31st), UPOCP (online CP by universal portfolios, Liu, Dobriban and Orabona, 45th), and Wang and Hyndman’s methods from the R package conformalForecast: WangHyndmanACP (64th; with clip=True 36th, documented: clipping drops the guarantee), WangHyndmanSCP (58th; weighted=True 66th) and WangHyndmanPID (53rd). Same intervals as the study’s code to 1e–15 to 6e–14.
ConformalPID(unit_free=True) and run(..., batch_size=k): the study’s quantile tracker (KI=0, 33rd) and conformal PI (55th), to 2e–14.
New module pyconformal.reservoir: ResCP (reservoir CP, Neglia et al., ICLR 2026; 38th, 37th with temperature="tune"). Identical intervals.
New module pyconformal.residual_quantile: CQACP (conditional quantile adjusted CP, Yu, Zhu and Zhu, ICML 2026; 40th; needs SciPy). Identical intervals with the study’s quantile forest.
New module pyconformal.regimes: CPTC (CP for time series with change points, Sun and Yu, NeurIPS 2025; 43rd) on MarkovSwitchingAR, a Markov-switching regression fitted by EM. Same intervals to 1e–12.
pyconformal.online_quantile: EnCQR (Jensen, Bianchi and Anfinsen, 44th), EnsCQR (bagged CQR with an online correction, 46th) and HQRWACI (heteroscedastic quantile regression with width-adaptive CI, Sebastian, González-Guillén and Juan 2024, 62nd; its quantile regressions repeat statsmodels’ iterations, so statsmodels is not needed). Same intervals to 3e–15.
pyconformal.univariate: NaiveInterval (56th), SeasonalNaiveInterval (42nd) and MarginalInterval (static, rolling and seasonal: the study’s SMCI, RMCI and SeMCI, 57th, 51st and 52nd). Same intervals to 2e–14.
Speed, full protocol on four series against the study’s code with the same intervals: 2x to 112x for most; CPTC 10x (forward-backward passes compiled), Wang and Hyndman’s methods 2x to 9x (compiled), HQR-WACI 1.6x. Where the time is a quantile forest (CQACP, EnCQR, EnsCQR), 1x with the same forest and 4x with pyconformal’s. benchmarks/speed_places31.py times them against the public alternatives.
README and docs home: the whole study (all 66 places) in one library, about seventy methods; the PyPI page shows this README.
Tests: tests/test_places31.py checks every new method against the study’s intervals on a stored stream (tests/data/places31_reference.npz), with and without numba.
v0.1.8
README: the forecasting study’s top 30 with their scores, and the new methods in “What you get” (the PyPI page shows the README of the latest release).
New docs page: which forecasting method, when, by situation, with the study’s places and one example each.
Tests: the exactness checks against the study’s models (quantile-forest, skaters) now run on GitHub (extra study); GitHub Actions moved to Node 24 versions.
Docs: corrected author lists for CP-TSD (Prinzhorn, Nijdam, van der Linden and Timans, COPA 2024) and RCI (Feldman, Ringel, Bates and Romano, TMLR 2023).
v0.1.7
Why: the large-scale study of conformal prediction for time-series forecasting (Manokhin, Nurmatov, Sreenivas and Liang 2026, doi:10.5281/zenodo.24715782) ranked 66 configurations on 50,143 series. Every configuration in its top 20 can now be run from pyconformal, with the same intervals as the study’s code.
New module pyconformal.trackers, nine online methods with the interface of ACI (calibrate, threshold, update, run, and run(..., batch_size=k) for outcomes revealed in batches): SAOCP (Bhatnagar et al. 2023), DecayOCP (Angelopoulos, Barber and Bates 2024), LinearQuantileTracker (LQT, Areces et al. 2025, with the authors’ tuning grid), ACIBet (Podkopaev, Xu and Lee 2024), BellmanCI (Yang, Candès and Lei 2024), BCACI (bias-corrected ACI, Lade et al. 2026), RollingOriginCP (Halkiewicz 2026), DriftOCP (Liang, Ren and Chen 2026) and RCI (Feldman, Bates and Romano 2023); and WeightedQuantileConformal (recency-weighted empirical quantile, the study’s NexCP and WeightedConformal).
New option clip=True on AdaptiveConformalInference, DtACI, AgACI and BCACI: the always-finite rules that libraries and the study run (working levels held inside [0, 1], plain empirical quantile; for AgACI the authors’ two-sided BOA aggregation). Documented effect: the guarantee of the method no longer holds; in exchange no interval is infinite. Default unchanged (clip=False, guaranteed). run(..., batch_size=k) with clip=True.
Checked against the study’s implementations on 13 series, 11 levels, batch sizes 1 and 10: the same intervals to 1e–13, except AgACI(clip=True) (same scores; the study’s code loses digits in its aggregation weights when the experts nearly agree). Reference radii in tests/data/trackers_reference.npz.
New: CSPAuto, Conformal Seasonal Pools with the target (levels or one-step changes) and the seasonal period (none, declared, the hour of sub-hourly data, and with acf_peak=True the highest autocorrelation peak) chosen by weighted interval score on the history: the study’s CSP_auto and CSP_auto_acf, first and second of 66, and csp-forecaster 0.3.0’s CSPAuto. Same choice as the study’s code on 11 of 13 series; the other two are ties within sampling noise. update() appends new values.
New module pyconformal.evaluation: the study’s rolling-origin protocol (rolling_origin_design), its reference (SplitConformalReference: split conformal prediction with the plain empirical quantile), per-series metrics (coverage, tail misses, width, Winkler, MSIS, shares of infinite, inverted and missing intervals; MAE, RMSE, bias, MASE, RMSSE, sMAPE, MAPE; WIS and quantile CRPS with the study’s failure rules) and the headline score rcwis with pfva. Identical to the study’s scorer on 286 method-series runs, and to its aggregation including the bootstrap interval.
MultiQT.run(..., batch_size=k, reset=False): outcomes revealed in batches (one step size per batch, the authors’ delayed-feedback rule) and continuation after a warm-up. With these, MultiQT gives the study’s MultiQT and MultiQT_scaled intervals to 1e–13.
Speed (benchmarks/speed_trackers.py, time per step on 5,000 calibration errors): SAOCP 7.5 µs, 119 times faster than salesforce/online_conformal; DtACI with clipping 14 times faster than salesforce’s FACI; LQT 2.8 times faster than conformalopt; every tracker under 130 µs per step. Against the study’s own implementations: 2 to 82 times faster with the same intervals.
Places 21 to 30 of the study, each checked against the study’s code on 13 series at 11 levels with outcomes revealed in batches of 10:
SFOGD (scale-free online gradient descent, 26th): same radii to 1e–14.
New module pyconformal.univariate, forecasters that read only the series (fit(y), predict_interval, update, run(y, alpha, batch_size)): NaiveDiffInterval (21st, same intervals to 1e–14); CPTSD (conformal prediction with STL decomposition, Prinzhorn et al. 2024, 30th; on pyconformal’s STL, which gives statsmodels’ decomposition to 1e–13; same intervals as the study’s code to 1e–10 when fed the same histories; inside a batch it uses every earlier value, where the study’s code dropped values on series with fewer lags than the batch); LaplaceSkater (Peter Cotton’s laplace forecaster, 24th; needs pip install skaters; same intervals to 1e–12, twice as fast as the study’s loop).
New module pyconformal.online_quantile: QuantileRegressionInterval (23rd; identical intervals with the study’s quantile forest) and AdaptiveEnbCQR (adaptive ensemble CQR, Sousa, Tomé and Moreira 2023, 25th; same intervals to 1e–14). Any model with predict(X, quantiles=...); pyconformal’s quantile forest by default, 4 to 6 times faster.
KOWCPI (Lee, Xu and Xie, ICLR 2025, 28th) with NadarayaWatsonQuantile (weighted Nadaraya-Watson quantile regression with the Hall-Presnell tilt and AIC bandwidth, compiled): same intervals as the study’s code to 1e–15, 8 times faster.
SPCI options for the study’s variant (29th): batch_size (one quantile model per step of a batch, the authors’ multi-step code), conformalize (CQR widening), beta_grid="closed", quantile_model= (any quantile model). Same intervals to 1e–14. Defaults unchanged.
EnbPI(quantile="empirical"): NumPy’s 1 - alpha quantile, as in the paper’s code and the study (EnbPI_RF, 27th; same intervals given the study’s ensemble). EnbPI.run(..., alpha=[...]) and SPCI.run(..., alpha=[...]) give several levels from one pass of the members.
THIRD_PARTY_NOTICES.md: the Apache 2.0 notice for the code that follows salesforce/online_conformal, and credits for the Bellman CI programme (ZitongYang/bellman-conformal-inference) and the BOA aggregation (R package opera).
v0.1.6
pyconformal 0.1.5
Panel data, multi-level online quantiles, and two fixes.
New
WeightedTQA: online conformal prediction for panel data (W-TQA; TQA as the equal-weight case).MultiQT: calibrated quantile forecasts at many levels at once, online, never crossing.PanelPredictiveSystem: predictive quantiles for each unit of a panel, under partial feedback.
Fixes (upgrade recommended)
- A classifier's
calibratethat fails now leaves the object exactly as it was. In 0.1.4 a failed call with a different number of classes kept the old scores, and laterpredict_setcalls used them. QuantileResult: a series with no observed outcome, or a missing query, now givesnaninstead of a number.
Full list: https://github.com/valeman/pyconformal/blob/main/project/CHANGELOG.md
pip install -U pyconformal
pyconformal 0.1.4
SplitConformalClassifier:groups=atcalibrateandpredict_setfor Mondrian conformal prediction by any category, withgroup_thresholds().- Documentation site: https://valeman.github.io/pyconformal/ with one page per method, a runnable minimal example on each, a "What's inside" index and an FAQ. Every example is run by the tests.
pyconformal 0.1.3
0.1.3: ConformalDistributionRegressor for distribution-valued outcomes Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K16P3Qv5UBnzxjKqhVMdd1