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

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.0rc4.tar.gz (1.8 MB view details)

Uploaded Source

Built Distributions

mmu-0.1.0rc4-cp310-cp310-win_amd64.whl (166.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

mmu-0.1.0rc4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (276.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

mmu-0.1.0rc4-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.0rc4-cp39-cp39-win_amd64.whl (166.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

mmu-0.1.0rc4-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.0rc4-cp39-cp39-macosx_11_0_arm64.whl (154.1 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

mmu-0.1.0rc4-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.0rc4-cp38-cp38-win_amd64.whl (165.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

mmu-0.1.0rc4-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.0rc4-cp38-cp38-macosx_11_0_arm64.whl (154.1 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

mmu-0.1.0rc4-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.0rc4-cp37-cp37m-win_amd64.whl (165.6 kB view details)

Uploaded CPython 3.7m Windows x86-64

mmu-0.1.0rc4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (280.7 kB view details)

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

mmu-0.1.0rc4-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.0rc4.tar.gz.

File metadata

  • Download URL: mmu-0.1.0rc4.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.0rc4.tar.gz
Algorithm Hash digest
SHA256 43c33366064e77e55e4bd233b82c526997efd06d9ed6a312baa5b3254e8e9dcf
MD5 b5d92c6c14421fd997062281dae33b38
BLAKE2b-256 441ede25d215371c437354399ab3f6971383f3fbaa43c4b9e38fe89ebd3c1f1e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmu-0.1.0rc4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 166.1 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.0rc4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 634db4d2e668f93871d8ed8ea01292c0fc17eacd572ea5c345c451d6095bdc3a
MD5 cb555f7e0f3be2b6f09ff53b7ad58fb6
BLAKE2b-256 bf3581c98f85981bf27f9b0415b9fcdb574f5406bf95f1fab1ab6464d94eb93c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1e67142a5704efaddb8672ecfbc8c958101ce4a16d70e84d3d745bf24ff09a8f
MD5 8c29b02954be82660d865b1c96270c2b
BLAKE2b-256 cbc1208aca259dc9daa95e9b367487dce7bc2337f95131ba11e7cc21401156e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 306ed07ff4a47a523a449ff888b8ce1a59d399a6a7e39b6ed9219fdd4e683d86
MD5 e7c59070d3747042673b139c01b54c92
BLAKE2b-256 b7601f836f87be6f4547733138b54cfcfc6939cb3e5f79ac4f76ceeffca19c91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc4-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 19625d7d7f8f4d37e4f60900dc77ba3b3e1459578e5b66170d9b4ccf9425fcee
MD5 f26e51c003587c1b3cacfbb6e8cea8f5
BLAKE2b-256 e5a0594fdc5c0f3c3c361b6b87adec64de690da4ebef62ac6a18f27e402ea50a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmu-0.1.0rc4-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.0rc4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b3d790babfd66f68de9c2d215c69a9d92bd9cb959c53268e7d5d684436f11576
MD5 6a856c146599f008bdc24b53ac5de98e
BLAKE2b-256 cde585b850260361b51c743047ab8ccd6e9ae6cc4e129f17ed7392f14e4987af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c92e2bb3c51a4ff5107d7b79cd5e90b6f4529dcead287a8a30cb1062e8fe4acc
MD5 e06ec1d2301050148a8d67d5cc14a41d
BLAKE2b-256 690d76dfbd62c2d03d2692d7af687628942f06ccc5eea88e7bfe3dfea47be39d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 220e26d731276e98b049ce4fa2704c1c77d70910f2b6dcc7b1712a08a1b2dc2f
MD5 9325942cc85d9fbf83422eab4f7ad6d3
BLAKE2b-256 cb1426d85be0ae43204565615839e9789fd92a1651c8837ceae3b29238f98ff8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc4-cp39-cp39-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8c50a730ef7daa2f187eeadcd391d8afaf41980ed13feb4b184f307633a9c9be
MD5 658113ecc3c8b2cddba54a4d4ab6eb50
BLAKE2b-256 d0139754be7015d4feb05339adbf42fbda6a1f91649b27aa023b432dbd8182e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmu-0.1.0rc4-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.0rc4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b0b36c331451fcd3a4b32994d883e614136e96a45136f793626cbcea380416d6
MD5 cdd0bcbb87a3a4b2fd24c8bbe8043505
BLAKE2b-256 b6e6b6aa4745e996eb81f47752141eece78c0d4592f6175e0903e035b7472868

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c2088cbe586553af908869b3633dd18ddccafb04d33b05eb9fc5da25ff1ecb68
MD5 18007ce3484131115c1dbbb3ba917ed5
BLAKE2b-256 e00f02005b826641dd6fcddaf596a8c16cbdb571fbe317ec4f9f55ea0a98dbe8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc4-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 307eca2ffb6d35060c7667f0477d02547a111a5afbb5eff2eeaa5c4b64a93758
MD5 245b9374f921118e08526b86277980c8
BLAKE2b-256 2db33357a60d7a6924f654fdb39681a51840315be1dc50fe1e52e4090c5258d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc4-cp38-cp38-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 859b2ea329a52d8897f4afbfd6d94400b89777f7fdec4809461c5246f96346b7
MD5 e93f01f9982e3cc3ef868bce10820ddf
BLAKE2b-256 12f8fc1f1a58c77255ad1439cf6f15c80a580ef1878ffce672d32ae1127162a9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmu-0.1.0rc4-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.0rc4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 3e6f9bc9350f9b0c8ac38b385ca7153eeac66fc59d7a31f12b141ac1a7c2ecbc
MD5 ac585c6403275eec1c1890bb2127f399
BLAKE2b-256 36afbcfd2ebbd9b41adad5049cfd43320492ca7f872e286a060aa06a1cbba389

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7eaf6f5d082c742fb823d67dcc8336cd5b7592ead1f653746418c04419fdc882
MD5 4aa4a1dcb0f2f9484b7a4d2e1ad43712
BLAKE2b-256 6bbc7dea22fbafad9f5af5d8ced4bbd70a46b50b8fcd7c448c3c5c1ebe50e8f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mmu-0.1.0rc4-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3d749a620590360247bbcb22fcdb8a1e488981f68a40039d789d4cd21929cc48
MD5 66510f9bb07e97eab7446681e20977b2
BLAKE2b-256 863332eafe834410f522f88bbde4e251e81a20d95045f468697d0de3b94f7c46

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