Skip to main content

uncalibrated-linearsvc

CI

uncalibrated-linearsvc provides a small scikit-learn-compatible wrapper around sklearn.svm.LinearSVC that adds a predict_proba() method.

What It Is

The package exposes LinearSVCWithUncalibratedProbabilities, a subclass of LinearSVC. It keeps the normal LinearSVC API and behavior, then implements predict_proba() from the classifier's decision_function() output.

This is useful when downstream sklearn tools expect probability-shaped output. One motivating case in the source is multiclass ROC AUC, where roc_auc_score() requires per-class scores that sum to 1.

How It Works

predict_proba(X) calls decision_function(X) and passes the resulting margins through genetools.stats.run_sigmoid_if_binary_and_softmax_if_multiclass():

  • binary classifiers use a sigmoid transform and return shape (n_samples, 2);
  • multiclass classifiers use a softmax transform and return shape (n_samples, n_classes).

Rows are normalized to sum to 1, matching the shape expected from sklearn classifiers with predict_proba().

Important Limitation

The returned values are uncalibrated. They are transformed SVM decision margins, not calibrated probability estimates. Use them when you need normalized probability-like scores for sklearn APIs, not when you need well-calibrated confidence values. For calibrated probabilities, use sklearn's calibration tools instead.

Installation

pip install uncalibrated_linearsvc

The package requires Python 3.8 or newer and depends on numpy, scikit-learn, and genetools.

Usage

from uncalibrated_linearsvc import LinearSVCWithUncalibratedProbabilities

clf = LinearSVCWithUncalibratedProbabilities(
    dual=False,
    multi_class="ovr",
    random_state=0,
)

clf.fit(X_train, y_train)

predictions = clf.predict(X_test)
probability_like_scores = clf.predict_proba(X_test)

Because the class subclasses LinearSVC, constructor arguments such as dual, multi_class, and random_state are the same as in scikit-learn.

Development

pip install -r requirements_dev.txt
pip install -e .
make test
make lint

The test suite covers binary and multiclass predict_proba() shape handling and row normalization.

Changelog

0.0.1

  • First release on PyPI.

Metadata

Release files for uncalibrated-linearsvc 0.0.2

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

Source distribution (sdist)

Source distribution for uncalibrated-linearsvc 0.0.2
File Size Uploaded Provenance Actions
uncalibrated_linearsvc-0.0.2.tar.gz 11.9 kB Without provenance Details for uncalibrated_linearsvc-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for uncalibrated-linearsvc 0.0.2
File Interpreter ABI Platform Actions
uncalibrated_linearsvc-0.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details for uncalibrated_linearsvc-0.0.2-py2.py3-none-any.whl

Total release size: 16.4 kB

Release files / uncalibrated_linearsvc-0.0.2.tar.gz

Download URL uncalibrated_linearsvc-0.0.2.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e12473b328d549993fecf3d16e5bbf2e479567b944fc94fe5ffff6a662fc249d
BLAKE2b-256 checksum
How to use checksums
8b8d6cdcc3580efe7006bf4bce78a91f5f761c0b42e1845118e63242c019abf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / uncalibrated_linearsvc-0.0.2-py2.py3-none-any.whl

Download URL uncalibrated_linearsvc-0.0.2-py2.py3-none-any.whl
Size 4.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d159253fdeb9f8e63f29eb25aeae22e1e58f967308f7574209e6cab34f0eec9f
BLAKE2b-256 checksum
How to use checksums
25c99cd7301ecee968ef27ddadf1a2525dc9761121483fb9a57cbada94f87a38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for uncalibrated-linearsvc 0.0.2

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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