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, y, yhat = mmu.generate_data(n_samples=1000)

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

# 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.0rc2.tar.gz (5.6 MB view details)

Uploaded Source

Built Distributions

mmu-0.1.0rc2-cp310-cp310-win_amd64.whl (167.3 kB view details)

Uploaded CPython 3.10 Windows x86-64

mmu-0.1.0rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (277.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

mmu-0.1.0rc2-cp310-cp310-macosx_11_0_arm64.whl (156.5 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

mmu-0.1.0rc2-cp310-cp310-macosx_10_13_x86_64.whl (457.0 kB view details)

Uploaded CPython 3.10 macOS 10.13+ x86-64

mmu-0.1.0rc2-cp39-cp39-win_amd64.whl (167.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

mmu-0.1.0rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (277.3 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

mmu-0.1.0rc2-cp39-cp39-macosx_11_0_arm64.whl (156.6 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

mmu-0.1.0rc2-cp39-cp39-macosx_10_13_x86_64.whl (457.0 kB view details)

Uploaded CPython 3.9 macOS 10.13+ x86-64

mmu-0.1.0rc2-cp38-cp38-win_amd64.whl (167.3 kB view details)

Uploaded CPython 3.8 Windows x86-64

mmu-0.1.0rc2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.8 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

mmu-0.1.0rc2-cp38-cp38-macosx_11_0_arm64.whl (156.6 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

mmu-0.1.0rc2-cp38-cp38-macosx_10_13_x86_64.whl (457.0 kB view details)

Uploaded CPython 3.8 macOS 10.13+ x86-64

mmu-0.1.0rc2-cp37-cp37m-win_amd64.whl (166.8 kB view details)

Uploaded CPython 3.7m Windows x86-64

mmu-0.1.0rc2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (281.3 kB view details)

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

mmu-0.1.0rc2-cp37-cp37m-macosx_10_13_x86_64.whl (452.2 kB view details)

Uploaded CPython 3.7m macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: mmu-0.1.0rc2.tar.gz
  • Upload date:
  • Size: 5.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for mmu-0.1.0rc2.tar.gz
Algorithm Hash digest
SHA256 a11e19c396363424b07dfe7df3e097afe5bb45870017f07f7195e7dd2104580e
MD5 3f21f4259ccab892107c9932a25a8cfe
BLAKE2b-256 3ce93222f4ce9b1b744fc76bd0d4ee6e3dfc8763f753a783d72d7f72f19f0a9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmu-0.1.0rc2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 167.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for mmu-0.1.0rc2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e6c42bd0f8ffc022d27c54031d872bec49e5e654199b12bcee1d08d5cbd33799
MD5 7a3deacaeee59c252365a271f6fa718c
BLAKE2b-256 34230307f8dc4cfe76851c00b50a91bec1c6dad05bfd4cedfdd8fc0bd217b70f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa610a2b34dc9e78652b9d3a9f7767998dc1ee09239aa3a206c4eab64febbf9b
MD5 a0e0e9a9ca406a88f7ebd862c8f85683
BLAKE2b-256 4306cfb542bd500461a4446de0858b081b5dc6611e897f38e0127668e6aeb17e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5d98801a8672221d9dc17aa7cf0e9e618904852c12eac0f72ee8eba1c4367100
MD5 e7e6e62b56c29ac89c687fd849ce490e
BLAKE2b-256 91ec969a0f3e3c6fe59228d49342d3afb06bdaea3d04e65586de133fcc047e67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc2-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 1b86df5109d57c3a634195ff74d8393e193f3577335fa2870d77e6583c4eaf1d
MD5 7647536e88ff9303c93a6b5cec70f144
BLAKE2b-256 dbe1cd5ee81ea7790f7a0250a6966b08081c66d81beb9862ee5d99f878b3e99f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmu-0.1.0rc2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 167.4 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for mmu-0.1.0rc2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 229ed7f724cbb523726c199028a5efa8860d76d7a58715db72bb5a43affda7dc
MD5 2e507a341eabf8b42e4623459e9e8bdd
BLAKE2b-256 29201758a48782435dc1afbd5580aafbeab51efd6d97d14ebd035d654c8ab1c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b6e80280a26b57e3a9aed46396e3c4f0e59c28fee5d96c341001af874effc0cd
MD5 3a3e93da42ca7233edc02eaa43c582e4
BLAKE2b-256 dade2a469e1140e0632360a57c5a16d85af3875c4f602dbf2a2bf8897f2f0bf2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 036ad38005564ce5ce2fa4e051505e036766f1168c20ab29bdf7b8d2d051236e
MD5 7bcf74302aa92ef7046ba5432d0de78d
BLAKE2b-256 ce74b6f3379f8dc578bb57a6fe05247d7a632c5d6dd0b557fc944966f031bfef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc2-cp39-cp39-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 eb3748c1db4c2f7a57dac529b01b0abc7443ae4c1f25d4ae9d62388553dba698
MD5 b73805c61a55f9208a675f660441b1dd
BLAKE2b-256 8c533a8a9eaffae6757c278724f18d6c670b9ac7d1a9aaeb670f2fc72891b55c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmu-0.1.0rc2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 167.3 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for mmu-0.1.0rc2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 fc8cba6a249c9695e6bac3991f0b5bc2c171832eb12a8a2a4c3e459beabc2f23
MD5 458ff711ac86ffd432ff1195ddcc9041
BLAKE2b-256 0253f6cbd33eb98b74566f6d3ba9ba07f107d7c31c375908b4b6f40a3a40530e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4c7175d00a0f804419983dad344a4594856a7435ccd944596eefe3e2ddf16801
MD5 81edd9940306db98731294dc507eb16b
BLAKE2b-256 7f99d2a42a69411ddc1984c56bf83350183d117c28e58c2a968cba25d68b1e16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cadb9bcf1ae66570a2823afa2aefa59f30d80db3e993d572f1f04507c2437ef8
MD5 81b2e55561d2f98f37f8609496e436e7
BLAKE2b-256 2a5c02d49f66dcdafe4aacd0f1ffad5a7cb761e64be9320b071b3cccec1eb97d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc2-cp38-cp38-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 aabe398ca396fe636b43c6943800ba5b27d0f72ad0ebd9871b51f4620e2b26db
MD5 62fc2976dd53844897acce346ce77ce7
BLAKE2b-256 effa2e5b44b6ca20435b8c11ac560ed9524c218c6607532938e25e644c2a2bdb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mmu-0.1.0rc2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 1069f4bdcb654faa33fd0784691684d1f848b3f3ad88cd32743f7b90282386a7
MD5 0ad2ece27661605128e75a48a5afc4da
BLAKE2b-256 81d8c33d8d7b9d60b3f483451c03853afcd3da80e69a2f67c05a0e9c97583919

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b1a52d81a7e2eca9a2fb66c654b09f68b895ef3c5d0b6916259fe4b9c0930e7c
MD5 c47ae429068442a577b59fcddf8dc484
BLAKE2b-256 d04257af3f6e2450334555cc326146b71a99d54c435d4090ab1e3a01665c32a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc2-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 76e9044b9c19c97e4f232a8d207127b2447669d59acf2f5e4da7cdfc9a2d1e9c
MD5 7617fe2b7d5986fa7ebdad0a43d58979
BLAKE2b-256 2f19e32151819ea1c99de752cf4e3302dbab8ec86a2f72a50914c21a12b8d1ac

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