Compute uncertainties on classification model metrics.
Project description
A library for the evaluation of model performance and estimation of the uncertainty on these metrics.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file mmu-0.1.0.tar.gz
.
File metadata
- Download URL: mmu-0.1.0.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e6a07df97113bd29cd7106437e2df25e3c5e1b5c0bae814d819a9984d775f38 |
|
MD5 | 7324146b6a463cbf2dcd5988223a1bc7 |
|
BLAKE2b-256 | c4c73124a448d43635c8f48536fde88d3ed01df818819043356ac82e67768917 |
Provenance
File details
Details for the file mmu-0.1.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 187.7 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 473fc1a8ece602e4f5cf776e9381dfb97e76377fd7dd973c663db4bafce8a972 |
|
MD5 | 6c2741ac3f67892256c062c9df5357d3 |
|
BLAKE2b-256 | 0ad5925c420e8c9b46aaead683f254b4e8a6e631904b805ca3ccf81e37550be0 |
Provenance
File details
Details for the file mmu-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 314.1 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb712301fbffdcc9c30f9ae53750dac98c83b1c136849d94c4e78b849f8365b6 |
|
MD5 | 1dab47e3d02b64a8c643279ad5e42bbf |
|
BLAKE2b-256 | 1e1be7ce060f9fbabfed8f91f736f316baf9e27da9d0c425515fdf82d89e5f99 |
Provenance
File details
Details for the file mmu-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 172.8 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbf3b4ada370eec63415c9d7acd792073e7286b44c6e8bb43e4876f8573e2752 |
|
MD5 | 2eb3b1eef4b57df1a1447cc91a828188 |
|
BLAKE2b-256 | 804ff995071b01c26daa7e6a99a53cd96cf8073aeaedd44901c7e344e70e9ab9 |
Provenance
File details
Details for the file mmu-0.1.0-cp310-cp310-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp310-cp310-macosx_10_13_x86_64.whl
- Upload date:
- Size: 194.8 kB
- Tags: CPython 3.10, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61d36e8ef773b81b1e6632ba9a0f7d8911b0ad9e5097f701db61d48f4eb1298a |
|
MD5 | 03492429a5906af5064538c77a3955f6 |
|
BLAKE2b-256 | f20b62fc96644f874de2552bfa515a8d933aea3ebe20849b30536bab33d712a0 |
Provenance
File details
Details for the file mmu-0.1.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 187.8 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13772cf80b0732d358b642fb39246e16dee3f1a65ce7f5ebd4b961eee2469c7c |
|
MD5 | 900a20d340eaad1e321d9c6b3622acce |
|
BLAKE2b-256 | 3fa500b5d693fcf90cd10b75014da24578a3ea4133557c3954b99e4af28f02e3 |
Provenance
File details
Details for the file mmu-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 314.4 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29f14257d19b7d37ce360e43056212e9237b10aaa212b78bbb702f044b5ee8ac |
|
MD5 | fab750e343836fe0b643aca540e21b4c |
|
BLAKE2b-256 | c8c94d6a065b1d632275c870d156ebb13569fa6189c37fe177446eaabb0fccfc |
Provenance
File details
Details for the file mmu-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 172.8 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a041f9371bdda05aaeac85d94a1c99832878f01bf137692b4d2f75a078052ec |
|
MD5 | fd8c4d9ab1af9a9180411a213c470fe7 |
|
BLAKE2b-256 | 7114dbfed8ee591688232ddf7d3d2477b6257f04c4a355353d7552d6ad5a8586 |
Provenance
File details
Details for the file mmu-0.1.0-cp39-cp39-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp39-cp39-macosx_10_13_x86_64.whl
- Upload date:
- Size: 194.9 kB
- Tags: CPython 3.9, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a95e667e4ae676db3e33334bd6dfdf44205cacb49cfaa1761eec80108dc90301 |
|
MD5 | f9ea9a17c274ccc7106abb43429563d8 |
|
BLAKE2b-256 | 764301fef1e5ebcef1b185a27e7236c66d5101baf80433cc6d72e5a7bc719740 |
Provenance
File details
Details for the file mmu-0.1.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 187.6 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28ac24b2a4b5e6b7b3628348a74f699e9bc9e35f65743a631fc4023fed4b05b0 |
|
MD5 | 3aabaf922cbb20cbbb6ab1e767f926e5 |
|
BLAKE2b-256 | a62115b925a99024d249fb423b0ab9ffd95035818b6c322fc05902062c875655 |
Provenance
File details
Details for the file mmu-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 313.7 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5931e859079bc4c8e43b2c7779c5e82ef549fff8ff373fb92c8d5806ca0a2bdf |
|
MD5 | d2dcb8391bfca52f37a0d8aedc096435 |
|
BLAKE2b-256 | 03073bfc04b49fa47f719a28a98051865c653c5c3dff7ad09dff283a12b4f1db |
Provenance
File details
Details for the file mmu-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
- Upload date:
- Size: 172.8 kB
- Tags: CPython 3.8, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e39e363aa97ff0b9d4947c5fe3e150fe8281e01a2698bb38cc825a89b09fcb3 |
|
MD5 | daeef778fc833a6e9936b3ea7f531883 |
|
BLAKE2b-256 | b1b25f63aa39a957f4e375bc5d6c5e576f7e2c3d3f49bec1377cc879e4c00661 |
Provenance
File details
Details for the file mmu-0.1.0-cp38-cp38-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp38-cp38-macosx_10_13_x86_64.whl
- Upload date:
- Size: 194.8 kB
- Tags: CPython 3.8, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72fdddad5f7ef952f451d1e4fed8acfecdc20931149e76d6ead668ad6f18b9e9 |
|
MD5 | 4d85ed51d8b287001af9baf7a025d70b |
|
BLAKE2b-256 | 89def36b9df9a7c31f1196b7b953f46003c13ba3b9b3edee563541f5b956dcfb |
Provenance
File details
Details for the file mmu-0.1.0-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 186.5 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f504c841211d190cc25dd3e6fb4545e2be18ed769c5df2df756859e1ed57668f |
|
MD5 | 02bf2ad629b704dce9bd9edcefb29271 |
|
BLAKE2b-256 | 56e902addef6be995872795ed005ea4fd61878e29015c529541bd1343ccccf2f |
Provenance
File details
Details for the file mmu-0.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 320.0 kB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a6a3e7f155426724eec240dd5bd8dc8471f5f0cdafdec946deadef5276e5571 |
|
MD5 | 9860c4b2551df166a62e782a2a1e0c71 |
|
BLAKE2b-256 | 39e555c24bb2f639bd7e7ce75cbb1315ec166ee7dd7ea4573d1b4461f287756e |
Provenance
File details
Details for the file mmu-0.1.0-cp37-cp37m-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: mmu-0.1.0-cp37-cp37m-macosx_10_13_x86_64.whl
- Upload date:
- Size: 191.1 kB
- Tags: CPython 3.7m, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2103b187fae6d6fc1e3f8524fb83c49384f5f033d6c13510d0c45aed45534559 |
|
MD5 | a82b1fcbd2a8a5237849060b9f26ad90 |
|
BLAKE2b-256 | 835f1b6b29bac48d6c480801e9566edf11c6ece1a3ed8f1f4b729ebf7943a8ba |