Skip to main content

A collection of metrics for analysing confusion matrices

Project description

# David’s helpful metrics library

There are many different ways to evaluate a confusion matrix. This helpful module implements a large number of them

  • q1

  • q2

  • q3

  • q4

  • q5

  • q6

  • q7

  • dpower

  • agf

  • markedness

  • bcr

  • ber

  • gm

  • agm

  • op

  • req

  • tanimoto

  • roc

  • specificity

  • fprate

  • fnrate

  • precision

  • negativepv

  • plr

  • nlr

  • youden

  • accuracy

  • fscore

  • f2measure

  • fmeasure

  • f0_5measure

  • power

  • logpower

  • bajic_k

  • chisquare

  • ctg

  • yuleY

  • yuleQ

  • ivesgibbs

  • acp

  • acc

  • gdip1

  • gdip2

  • gdip3

  • hamming

  • jaccard

The original impelmentation was in Perl around 2005 and I appear to have not noted many of the references. My apologies.

Details of the calcualtion are in the docstring. This module should be used as follows:

from metrics import Metrics

Metrics.list_metrics() # lists method names

Metrics.list_metrics(verbose=True) # gives a dictionary with the docstring

Metrics.measure(method, tp=TP, fp=FP, tn=TN, fn=FN) # for True Positive, False Negative etc.

You probably want to wrap this with try .. except as it will show an error if inappropriate data is given. The measure method will convert counts to proportional data.

Don’t forget to Metrics.cite(method) which will give a list of citations, if available. If you wish to add to the citations then submit a pull request.

I’d like to expand the help text in due course for each metric.

Further information on many of the metrics and their behaviour can be found at (Tharwat, Applied Computing and Informatics (2018),https://doi.org/10.1016/j.aci.2018.08.003)[https://doi.org/10.1016/j.aci.2018.08.003]

[Find this on BitBucket]( https://bitbucket.org/davidmam/metrics.git)

q1 q2 q3 q4 q5 q6 q7 dpower agf markedness bcr ber gm agm op req tanimoto roc specificity fprate fnrate precision negativepv plr nlr youden accuracy fscore f2measure fmeasure f0_5measure power logpower bajic_k chisquare ctg yuleY yuleQ ivesgibbs acp acc gdip1 gdip2 gdip3 hamming jaccard

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

confusion-metrics-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

confusion_metrics-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file confusion-metrics-0.1.0.tar.gz.

File metadata

  • Download URL: confusion-metrics-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/38.5.1 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.5.5

File hashes

Hashes for confusion-metrics-0.1.0.tar.gz
Algorithm Hash digest
SHA256 742a6029171448663dc14d594c4ec5f094f19827399bf1c37dea28372c99602c
MD5 03dd81229e6980a92986b272fdd58c65
BLAKE2b-256 e0811ab686cef0cf8b6820cef95e88c083985374a0ed75404479f38e920605b2

See more details on using hashes here.

File details

Details for the file confusion_metrics-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: confusion_metrics-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/38.5.1 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.5.5

File hashes

Hashes for confusion_metrics-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76c41f1f53f4365fe57ccc1e06815e3c1334bf1486e6bb0295a900d138247508
MD5 91e24ece54229fe59fa8f2513a197e3a
BLAKE2b-256 9b32076495f438d3ce2928c876cb5a975e1d541a95aae768784289ee1e4d1def

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