Skip to main content

CompStats

https://github.com/INGEOTEC/CompStats/actions/workflows/test.yml/badge.svg https://coveralls.io/repos/github/INGEOTEC/CompStats/badge.svg?branch=develop https://badge.fury.io/py/CompStats.svg https://dev.azure.com/conda-forge/feedstock-builds/_apis/build/status/compstats-feedstock?branchName=main https://img.shields.io/conda/vn/conda-forge/compstats.svg https://img.shields.io/conda/pn/conda-forge/compstats.svg

CompStats is an open-source Python package for the statistical analysis of the results of supervised-learning systems evaluated on a shared held-out test set, the setting of collaborative competitions (also called challenges). From the gold standard and the predictions of each system, it estimates by bootstrap the standard error and the confidence interval of every performance measure, tests whether the difference between the best system and each of the others is statistically significant, and corrects those tests for multiple comparisons. It implements the methodology of the article Analysis of systems’ performance in natural language processing competitions (Pattern Recognition Letters, 2024), which complements the standard selection of a winner, usually based only on the ranking of the scores.

Documentation

Installation

The package is installed from PyPI with

pip install CompStats

or from conda-forge with

conda install --channel conda-forge CompStats

Quickstart

The following example compares three classifiers on the digits problem.

from sklearn.datasets import load_digits
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import LinearSVC
from CompStats.metrics import f1_score

X, y = load_digits(return_X_y=True)
X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.3, random_state=0)

svm = LinearSVC(random_state=0).fit(X_train, y_train)
score = f1_score(y_val, svm.predict(X_val), average='macro', name='Linear SVM')
score(RandomForestClassifier(random_state=0).fit(X_train, y_train).predict(X_val),
      name='Random Forest')
score(GaussianNB().fit(X_train, y_train).predict(X_val), name='Naive Bayes')

score                 # point estimate and standard error of every system
score.ci              # 95% percentile bootstrap confidence intervals
diff = score.difference()            # paired differences against the best system
diff.p_value(correction='holm')      # p-values adjusted for multiple comparisons
score.plot()                         # performance with confidence intervals

The variable score holds the point estimate and the standard error of every system, and score.ci returns the percentile confidence intervals obtained from the bootstrap distribution. The call score.difference() computes the paired differences between the best system and each of the others, and diff.p_value(correction='holm') returns the p-values of those differences adjusted for multiple comparisons with Holm’s method. Finally, score.plot() draws the performance of the systems together with their confidence intervals.

Citing

When CompStats is used in academic work, the first reference below, which describes the methodology, should be cited. The second is the work it extends.

@article{Nava-Munoz2024,
  author  = {Nava-Mu{\~n}oz, Sergio and Graff, Mario and Escalante, Hugo Jair},
  title   = {Analysis of systems' performance in natural language processing competitions},
  journal = {Pattern Recognition Letters},
  volume  = {186},
  pages   = {346--353},
  year    = {2024},
  doi     = {10.1016/j.patrec.2024.03.010},
  url     = {https://doi.org/10.1016/j.patrec.2024.03.010}
}

@inproceedings{Nava-Munoz2023,
  author    = {Nava-Mu{\~n}oz, Sergio and Graff Guerrero, Mario and Escalante, Hugo Jair},
  title     = {Comparison of Classifiers in Challenge Scheme},
  booktitle = {Pattern Recognition},
  series    = {Lecture Notes in Computer Science},
  volume    = {13902},
  pages     = {89--98},
  year      = {2023},
  publisher = {Springer Nature Switzerland},
  doi       = {10.1007/978-3-031-33783-3_9},
  url       = {https://doi.org/10.1007/978-3-031-33783-3_9}
}

License

CompStats is distributed under the Apache License 2.0. See the LICENSE file.

Metadata

Release files for CompStats 0.2.1

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

Source distribution (sdist)

Source distribution for CompStats 0.2.1
File Size Uploaded Provenance Actions
compstats-0.2.1.tar.gz 51.5 kB Without provenance Details for compstats-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for CompStats 0.2.1
File Interpreter ABI Platform Actions
compstats-0.2.1-py3-none-any.whl Python 3 none any Details for compstats-0.2.1-py3-none-any.whl

Total release size: 108.9 kB

Release files / compstats-0.2.1.tar.gz

Download URL compstats-0.2.1.tar.gz
Size 51.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aa0500af12ee6e285b1ec13da87411e6093fee656f1e4a3329a6102af9e4ed0f
BLAKE2b-256 checksum
How to use checksums
7d4b81c6063ccd26699c668360f3297dcd0d95730173271ddd233848219a3ba3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / compstats-0.2.1-py3-none-any.whl

Download URL compstats-0.2.1-py3-none-any.whl
Size 57.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f7a84bb6fa69d0cb6733c1b94083cf1f51f683c9301b6a2bd577f6ede23cdcb
BLAKE2b-256 checksum
How to use checksums
ccf03f49c79d1ff7398333ffcf1ba3abdc0174ee84241e3bb3ccb6dbd3933035
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for CompStats 0.2.1

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.

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