Skip to main content

Poniard

Poniard logo

A poniard /ˈpɒnjərd/ or poignard (Fr.) is a long, lightweight thrusting knife (Wikipedia).

Poniard is a scikit-learn companion for multi-model diagnostics. Fit a handful of models, cross-validate them side by side, then answer the questions that actually matter:

  • Where do the models fail, and why?
  • Is model A really better than B, or is that fold noise?
  • Which model is good enough and cheap enough?

Then export a plain sklearn pipeline you own and leave. Not AutoML. Not end-to-end. Every feature earns its place.

Installation

pip install poniard

Plotting is an optional extra:

pip install poniard[plot]

Quick start

from sklearn.datasets import make_classification
from poniard import PoniardClassifier

X, y = make_classification(n_samples=200, n_features=10, random_state=42)

clf = PoniardClassifier()
clf.setup(X, y)    # configure: infer types, build preprocessing, CV, pipelines
clf.fit(X, y)      # cross-validate every estimator
clf.get_results()  # leaderboard with a dummy baseline

setup comes first on purpose: it lets you see what fit will do to your data and modify it before anything is cross-validated. fit(X, y) will also configure on its own if you skip it, but the preprocessor is never a black box — inspect clf.feature_types, reassign types, or add preprocessing steps between the two calls (see the in-depth guide).

The core loop

Poniard is built around one loop: compare → explain → decide → export.

1. Compare

clf = PoniardClassifier()                 # or PoniardRegressor()
clf.setup(X, y)                           # configure, then adjust preprocessing if needed
clf.fit(X, y)
clf.get_results()                         # mean scores, fit/score times

Every estimator is cross-validated on the same folds, with a DummyClassifier / DummyRegressor baseline included automatically.

2. Explain — error analysis

ErrorAnalyzer answers where and why your models fail. One call returns a structured ErrorReport:

from poniard.error_analysis import ErrorAnalyzer

report = ErrorAnalyzer.from_poniard(clf).analyze(X, y)

report.universal_failures   # samples every model got wrong
report.disagreement_set     # samples where models split (ensembling candidates)
report.lift_by_target       # classes/bins over-represented in errors (lift > 1)
report.lift_by_feature      # feature values over-represented in errors

3. Decide

clf.compare()                    # paired fold tests: is A really better than B?
clf.pareto()                     # best metric vs training time (Pareto front)
clf.best_under(seconds=0.5)      # best model within a time budget

4. Export

model = clf.get_estimator("LogisticRegression", retrain=True, X=X, y=y)
# a fitted sklearn.pipeline.Pipeline with no poniard references — deploy it

Feature overview

Area What you get
Error analysis Universal failures, disagreement sets, lift vs baseline — ranked per sample, sliced by target and features
Statistical comparison Paired fold tests so you stop trusting fold-mean leaderboards
Time / quality Pareto front and best-under-budget helpers
Preprocessing Automatic numeric / categorical / datetime type inference, imputation, encoding, scaling; per-estimator preprocessors (preprocessor_map) with a native profile for HistGradientBoosting
Tuning Grid, random, and halving search that re-enters the experiment as a new named estimator
Ensembles Diversity-aware voting / stacking built from your fitted estimators
Plotting Metrics, ROC, confusion matrices, residuals, feature importance (optional, requires [plot])

Docs and examples

  • In-depth guide — the full workflow, preprocessing internals, error-analysis semantics, tuning, ensembles, plotting, and export.
  • Examples — runnable scripts, executed in CI so they never go stale:
    • examples/00_getting_started.py — fit, results, predictions
    • examples/01_error_analysis.py — full failure-forensics workflow
    • examples/02_plotting.py — the plotting API
    • examples/03_preprocessing.py — per-estimator preprocessors and the native profile
python examples/00_getting_started.py

Estimator naming

Estimators are named by class name, with collision suffixes (_2, _3, ...). Override names with tuple syntax:

clf = PoniardClassifier(estimators=[("my_lr", LogisticRegression())])
# pipelines: {'my_lr': ..., 'DummyClassifier': ...}

Environment variables

  • PONIARD_TQDM_LEAVE — set to "True" to keep progress bars on screen after fitting completes. Default "False".

Python support

3.10–3.13, tested on Linux, macOS, and Windows.

Development

git clone https://github.com/rxavier/poniard.git
cd poniard
uv sync --dev
uv run pytest

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poniard-0.7.0.tar.gz (75.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poniard-0.7.0-py3-none-any.whl (55.9 kB view details)

Uploaded Python 3

File details

Details for the file poniard-0.7.0.tar.gz.

File metadata

  • Download URL: poniard-0.7.0.tar.gz
  • Upload date:
  • Size: 75.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for poniard-0.7.0.tar.gz
Algorithm Hash digest
SHA256 d4607daf0b2fbf97ad4fea74815e91ee832c844717af1746fb3503447187715b
MD5 e943cb1bcb203acb959f1798c8d58011
BLAKE2b-256 402dc1f2bc00a0d770a42fb54884d1e38f679070876a5b010189edcacedb21a7

See more details on using hashes here.

File details

Details for the file poniard-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: poniard-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 55.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for poniard-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15d3e74c87f8a425b8facbbc0965b57f3f1c2f745117091e113f2b509c730e69
MD5 b0bd62b93415150aca01deb8e3fc7ce1
BLAKE2b-256 cfe4f2928f3150e24b9dbb2950da83d10087d8a34d0d6b26a33b170c78e57871

See more details on using hashes here.

Release history Release notifications | RSS feed

0.7.1

2 files

This release

0.7.0 This release

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

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