Skip to main content

Compute uncertainties on classification model metrics.

Project description

A library for the evaluation of model performance and estimation of the uncertainty on these metrics.

Uncertainty on the precision-recall curve
MacOS build Linux build Windows build Documentation License PyPi

Documentation

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.1.tar.gz (2.1 MB view details)

Uploaded Source

Built Distributions

mmu-0.1.1-cp311-cp311-win_amd64.whl (187.9 kB view details)

Uploaded CPython 3.11 Windows x86-64

mmu-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (314.1 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

mmu-0.1.1-cp311-cp311-macosx_10_13_x86_64.whl (194.7 kB view details)

Uploaded CPython 3.11 macOS 10.13+ x86-64

mmu-0.1.1-cp310-cp310-win_amd64.whl (187.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

mmu-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (314.1 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

mmu-0.1.1-cp310-cp310-macosx_10_13_x86_64.whl (194.8 kB view details)

Uploaded CPython 3.10 macOS 10.13+ x86-64

mmu-0.1.1-cp39-cp39-win_amd64.whl (188.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

mmu-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (314.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

mmu-0.1.1-cp39-cp39-macosx_10_13_x86_64.whl (194.9 kB view details)

Uploaded CPython 3.9 macOS 10.13+ x86-64

mmu-0.1.1-cp38-cp38-win_amd64.whl (187.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

mmu-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (313.7 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

mmu-0.1.1-cp38-cp38-macosx_10_16_x86_64.whl (194.9 kB view details)

Uploaded CPython 3.8 macOS 10.16+ x86-64

mmu-0.1.1-cp38-cp38-macosx_10_13_x86_64.whl (194.9 kB view details)

Uploaded CPython 3.8 macOS 10.13+ x86-64

mmu-0.1.1-cp37-cp37m-win_amd64.whl (187.0 kB view details)

Uploaded CPython 3.7m Windows x86-64

mmu-0.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (320.0 kB view details)

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

mmu-0.1.1-cp37-cp37m-macosx_10_13_x86_64.whl (191.1 kB view details)

Uploaded CPython 3.7m macOS 10.13+ x86-64

File details

Details for the file mmu-0.1.1.tar.gz.

File metadata

  • Download URL: mmu-0.1.1.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for mmu-0.1.1.tar.gz
Algorithm Hash digest
SHA256 86e38084467edefadffeb9240d32aa096c8be93b26b08f6ae8e4b528e37f23a3
MD5 1c1c695bc83feefb63168a1a73051e32
BLAKE2b-256 63ede1ebf56b3c6afe95c64d20c6ee96a63312a11f766300992f417a4982bc95

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: mmu-0.1.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 187.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for mmu-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3975db200b6578546ca59917b6cf972e4edf9821215e8ae485618dc3f7994c3a
MD5 e1435c5c54266942398d1a31b0ee1214
BLAKE2b-256 13eef8cb304094b047b07aadf3ad1b687e886d3ba95ba6f241dfc0fb2f864821

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c37dcaf7d12188d6d8e2ee63d805c752a9d64251b90f5d6e2325ad56f4f5533e
MD5 cdb31cc590a09af2405feff9438e7e7f
BLAKE2b-256 5481d8fe55f6b55ea8f3fbdfcc0cd34555693a57c752b4649d9028efcbdb59b0

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp311-cp311-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.1-cp311-cp311-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f42ef1e77582e6965f69f9caef9d7ed6ec19e31d009e37ca1641a5b3a8092ccf
MD5 88a8bf47aa33583ec01ff070d0931974
BLAKE2b-256 eb5420a90bb7f7a58b4b53705009fd664d32308e5fd5f811ca0bc0b31b71ad3e

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

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

File hashes

Hashes for mmu-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8a5af7065a0f9497b8d187c3caf05eb212aeb6deb9bb318b8908f26249316c5f
MD5 b8592f1a6a4a26cb93f9d4a4561d7a27
BLAKE2b-256 9bd73c04130f9e421d59302d78f66c429630dacbbfbc04faee9015bcb2c2e507

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a76351415ff7e90c7d466842c326d6aedde0bc6b65d54d267d8d48e542b54824
MD5 a4d572aa00cd8bbb4994beffc67fc061
BLAKE2b-256 1808ff2b895b188ebc8ad7e1cb404a02dd307de9939f9479feeaaf5d2d90ea10

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.1-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 580ce702014c962c86537fd0df4b6a035a193feae8fde2771e645e5aea5cce53
MD5 9914a5778af533df752f582765561a91
BLAKE2b-256 a2d70e31d9c2544a19d7c1c5c604ba0f2c86ddb345e5fb69deb9ca45308c5cde

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp39-cp39-win_amd64.whl.

File metadata

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

File hashes

Hashes for mmu-0.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 041a401a3bb7921ce59cc2fdfc7eb9aec43cc4c61de525989b25b829b409a9cd
MD5 6462d4c4993fb1c8433762f6a1f7b4a1
BLAKE2b-256 a759a6a3857f2676c176b94b14499208e5bd148db02dc3d9860a71c6c84e9d88

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 01552266b21cde6aac3128459a7f68e950b6e03a8f8ec7b2cbca7d855b307d90
MD5 3b55785c5da6c0bde1c274fab666e1a4
BLAKE2b-256 b97e7055f8b3469925ccc511c77b8e19cb00f6fd04dcbb0b59c28a203ef52966

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp39-cp39-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.1-cp39-cp39-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a72482de300cac69b7c6d5bc754a52b3e39872c3b08b4b4e77d26ccaa63765e2
MD5 128111989580a0d8ea79a90cc612e021
BLAKE2b-256 a1126478111d35ba7b602b3e0a5ac6b5d0fed2de3375257b23a3fb854fc0cc6e

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp38-cp38-win_amd64.whl.

File metadata

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

File hashes

Hashes for mmu-0.1.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 79f243994aa8a27dbcfe5b3fdb7f0b33c56b8134f1a5ec635d05cda74ee458e8
MD5 89de2b83c2be50bdee1806fbf7919464
BLAKE2b-256 f2cb521ba22683e9de7d6956ee64b4aca23277879d6da3ab11c2f03d1fd25686

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3c214392b974f3a5a885399c5fe938d8a493d48588e3740d5e377dbb4ad6a97f
MD5 3a0bdaa4ecb4cc9a9480105d5e092162
BLAKE2b-256 77ad01a083ce6545b64ec824174c46f6f2c2f2c44f5a10e4ef9ed2175a721757

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp38-cp38-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.1-cp38-cp38-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 286600a41162cc943f7cfc3804b173dbdf79722d1333b4d1760a360d78d8083e
MD5 72f7ecf016282acd9b51c7b9f7efc17b
BLAKE2b-256 8bd71b13e7c37cb89ed0776bab0abc38c8202f175ac0603122fabcc403258b13

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp38-cp38-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.1-cp38-cp38-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e1166413bbbf07bb260a5564556b2d32bfd03b9969b72dc8a4b0b0cd2cd0604e
MD5 0969a2d8b474ef6410af024d8e06bce5
BLAKE2b-256 3a4f74c6389f088392b71d570264ad0de03d7952ae97bdeea582b4b5c63cd63f

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp37-cp37m-win_amd64.whl.

File metadata

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

File hashes

Hashes for mmu-0.1.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 45ffe42de22eed788815c97ab7cae2625056ee350d757ac2727582e12c7415a4
MD5 723f0173caaabe42024693358c7aac2e
BLAKE2b-256 f64102432b58bce095732ad603f21175ce66fa9564dec21e6ee48d2e6e11bc0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5635c60dea3c63f2740aeecc5d94cbb37bf0040c0f999ea73ed215e98a1f7fd
MD5 3f4900a82bc2dab7c2889c927f54b807
BLAKE2b-256 82da943d2a5c66e6602a1d6879505da611af083d6aa3d03e468ac3c1adb7cbda

See more details on using hashes here.

File details

Details for the file mmu-0.1.1-cp37-cp37m-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mmu-0.1.1-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b7082905714cbadff7ef8fe20700cf9025c182758f883fdfeac62867a8dc3401
MD5 6c112d649fd550440bbcf171c13cee83
BLAKE2b-256 7a063e2dc6c0523ebc73dacbb1d7d8acb548ccc379863c871cf9fbddac86cc75

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