Skip to main content

Compute uncertainties on classification model metrics.

Project description

MacOS build Linux build Windows build Documentation License PyPi

Model-Metric-Uncertainty (MMU) is a library for the evaluation of model performance and estimation of the uncertainty on these metrics.

Documentation

MMU is currently in alpha state and not yet ready for production usage

Functionality

On a high level MMU provides two types of functionality:

  • Metrics - functions to compute confusion matrix(ces) and binary classification metrics over classifier scores or predictions.

  • Uncertainty estimators - functionality to compute the joint uncertainty over classification metrics.

We currently focus on binary classification models but aim to include support for other types of models and their metrics in the future.

Confusion Matrix & Metrics

Metrics consist mainly of high-performance functions to compute the confusion matrix and metrics over a single test set, multiple classification thresholds and or multiple runs.

The binary_metrics functions compute the 10 most commonly used metrics:

  • Negative precision aka Negative Predictive Value (NPV)

  • Positive recision aka Positive Predictive Value (PPV)

  • Negative recall aka True Negative Rate (TNR) aka Specificity

  • Positive recall aka True Positive Rate (TPR) aka Sensitivity

  • Negative f1 score

  • Positive f1 score

  • False Positive Rate (FPR)

  • False Negative Rate (FNR)

  • Accuracy

  • Mathew’s Correlation Coefficient (MCC)

Uncertainty estimators

MMU provides two methods for modelling the joint uncertainty on precision and recall: Multinomial uncertainty and Bivariate-Normal.

The Multinomial approach estimates the uncertainty by computing the profile log-likelihoods scores for a grid around the precision and recall. The scores are chi2 distributed with 2 degrees of freedom which can be used to determine the confidence interval.

The Bivariate-Normal approach models the statistical uncertainty over the linearly propagated errors of the confusion matrix and the analytical covariance matrix. The resulting joint uncertainty is elliptical in nature.

Installation

mmu can be installed from PyPi.

pip install mmu

We provide wheels for:

  • MacOS [x86, ARM]

  • Linux

  • Windows

Installing the package from source requires a C++ compiler with support for C++14. If you have a compiler available it is advised to install without the wheel as this enables architecture specific optimisations.

pip install mmu --no-binary mmu

Other build options exist, see the Installation section of the docs.

Usage

import mmu

# Create some example data
scores, yhat, y = mmu.generate_data(n_samples=1000)

# Compute the joint uncertainty on precision-recall curve
pr_err = mmu.PrecisionRecallCurveUncertainty.from_scores(y, scores)

# Plot the uncertainty
pr_err.plot()

See Basics section of the docs or the tutorial notebooks for more examples.

Contributing

We very much welcome contributions, please see the contributing section for details.

Project details


Download files

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

Source Distribution

mmu-0.1.0rc3.tar.gz (1.8 MB view details)

Uploaded Source

Built Distributions

mmu-0.1.0rc3-cp310-cp310-win_amd64.whl (166.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

mmu-0.1.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.5 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

mmu-0.1.0rc3-cp310-cp310-macosx_11_0_arm64.whl (154.0 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

mmu-0.1.0rc3-cp310-cp310-macosx_10_13_x86_64.whl (454.7 kB view details)

Uploaded CPython 3.10 macOS 10.13+ x86-64

mmu-0.1.0rc3-cp39-cp39-win_amd64.whl (166.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

mmu-0.1.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

mmu-0.1.0rc3-cp39-cp39-macosx_11_0_arm64.whl (154.1 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

mmu-0.1.0rc3-cp39-cp39-macosx_10_13_x86_64.whl (454.8 kB view details)

Uploaded CPython 3.9 macOS 10.13+ x86-64

mmu-0.1.0rc3-cp38-cp38-win_amd64.whl (165.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

mmu-0.1.0rc3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.2 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

mmu-0.1.0rc3-cp38-cp38-macosx_11_0_arm64.whl (154.1 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

mmu-0.1.0rc3-cp38-cp38-macosx_10_13_x86_64.whl (454.7 kB view details)

Uploaded CPython 3.8 macOS 10.13+ x86-64

mmu-0.1.0rc3-cp37-cp37m-win_amd64.whl (165.6 kB view details)

Uploaded CPython 3.7m Windows x86-64

mmu-0.1.0rc3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (280.6 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

mmu-0.1.0rc3-cp37-cp37m-macosx_10_13_x86_64.whl (450.1 kB view details)

Uploaded CPython 3.7m macOS 10.13+ x86-64

File details

Details for the file mmu-0.1.0rc3.tar.gz.

File metadata

  • Download URL: mmu-0.1.0rc3.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for mmu-0.1.0rc3.tar.gz
Algorithm Hash digest
SHA256 8173f9f7acb60688553039df0f5b3cffbfc7eee1bde72e77073bfe0e90cb53ee
MD5 349b7a42ed77921f7ae4fb16c943d6e0
BLAKE2b-256 6197eadac30990d4c312b753b55e46baf0bdf947801e0b6097ceeee144979065

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: mmu-0.1.0rc3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 166.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for mmu-0.1.0rc3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4b04782e5e75457dbf889a212adbfc3700f8183261bf11f15d291743067a30fd
MD5 8a656fba7f7d81c253c24f8740cda4b9
BLAKE2b-256 df7c7d4dde3f9047518631b0fd28737859626a1ff9cac77d42e3d980f43f3ac8

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a793b70cb6e9387678aef607ddd5cc8f7e36e7b1be174f7294c3a82dd1e0b33c
MD5 acb6e8eba874075219c7e3b3781ab875
BLAKE2b-256 9726c41a213400bfabb64b3fa09effa35998354ba5347f530a032b17e085d910

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c252b8db9edadc0a594559f054d9cb4949562a629529e1729ae9c1e35369618a
MD5 4b783fe1e9f1cff462c9251450ac8004
BLAKE2b-256 39f19f9592d4154f8e75a9d7bea1c212662bce13b30f38b5831ba8ff2189673f

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc3-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9fa0818bd4434b8113e38e11caecbca2ab4b2ac88868b564631fac545501cd0f
MD5 65cd027043d672762d10a0d54885b045
BLAKE2b-256 503a81711ceeb988b5b5505cb4ea5ef7782652aaf4cb43b2d8e98cc69ee882b5

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: mmu-0.1.0rc3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 166.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for mmu-0.1.0rc3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a79e146106110f5bfd8ab6217c43d8b51f13e27153e81377547d6ad0b176b362
MD5 d7b15a052b7dabdad48731c4c7f6490c
BLAKE2b-256 f47c8584fcde31374f2d4643e9d2df6a091fbbc3d0f855f56f0452acc5520fc8

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 afabd355ef9eac3ddfe63eae2f681cc3a4a37387adad45060c2c8e499d1647bb
MD5 7ab2f9faba631a4a4a48edcfe82edda1
BLAKE2b-256 bc388af5aea9f8ea9fcaa9c8955448bbee302bcf9a2ec077a8c250b9159783b3

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 afd91fa5bbfc06340925a278980f3915c20bfdc4a95ae36eb2c51e894831595a
MD5 fd4122102078231ad48956bc1f2ba473
BLAKE2b-256 7d7ec4d3db23ae2a607bc98bfebc03f6fbbe7580e38c4a246fec8cc6bcdadac5

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp39-cp39-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc3-cp39-cp39-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 232fee74a43ecd346eba69214810db6e0229d698b0102c3ac8b43fcb36a3efdc
MD5 3d80f5874e444c1bfb522419915e7e4a
BLAKE2b-256 3c645c43c73da5dfd723db17d9cdd9bde1b2e5fc75de0aa5cb842fb55b9cc668

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: mmu-0.1.0rc3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 165.9 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for mmu-0.1.0rc3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 37958ca661838fbd3fb546bd509946d47c6395f6d0773d095d959cfbfa38c432
MD5 e4e3e8c448cb3dd7052453e47da570d8
BLAKE2b-256 33e756b6a9183f95871f0fe758cda822c614c749260833f376bf67ab094647f5

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e50f683bd4244158d4b7297db95bffe5710e34c88a20c2012f3efd57488ea4f8
MD5 c12ce02d87196af3e83918b4aa9ff1dd
BLAKE2b-256 ad30d5ee2dc4ebaccf72e5abecddc9311b9a4c08b47fd60b2cca22a5ab7c2c6b

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70555b37f986b332648d41d50f19aac72b3720757a4fbb1680b69002a18bb3a1
MD5 af4ae21fe04a123845c5669106331104
BLAKE2b-256 b2a50e407d417a61105cfb1fca7a76a2019357b6d7adc6741da33e8e97fd605f

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp38-cp38-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc3-cp38-cp38-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 805f3d26a8c345a0fc1c9e82cb706b9fd7505fbc23f7923dc309297cf2ed28d3
MD5 389648ee4eadc6ed06b57706ab105415
BLAKE2b-256 617b8b5b4026bf96616869f77c6888f43e4f79abe57d45a2f022acf822ab9367

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: mmu-0.1.0rc3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 165.6 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for mmu-0.1.0rc3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 4c8a94a7f5b09b84372e21a93688551c48a3702f733fd4694e8e279eed6c612b
MD5 0a69b7283bac7577b3c8ec07eea156ae
BLAKE2b-256 9888b66e9a4f64b70bd7725ee2d2b6797d000f8cee2a1b6fbd0fc78ff5df8c9e

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d343a15d70bd4c4d86bda898f8b3e403d55da3434e99042d0c00638097288a05
MD5 dda2669e97c6fde4c67f9627b51ced7c
BLAKE2b-256 757bbb7d958f644c0359ae63e22889343ad2c806cac6f165261769fb43971cb9

See more details on using hashes here.

File details

Details for the file mmu-0.1.0rc3-cp37-cp37m-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.0rc3-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c383689aa0de3857cd0a19338417e14343853c43362ee7c6ad12780069af5879
MD5 8e4f2ae05ffdbd869fd91e7d633d1d8a
BLAKE2b-256 18736897d246d10eb650c9584951785c3bbb4b3d394c9d3d16104468c5e7ff6a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page