Skip to main content

Confusion matrix tool for binary classification.

Project description

Confusion matrix tool.

Further information:

Instalation

From source code:

python setup.py install

From pypi:

pip intall confumatrix

Usage

>>> from confumatrix import ConfuMatrix
>>> cm = ConfuMatrix(a=10, b=1, c=10, d=3)
>>> cm.accuracy()
0.5416666666666666
>>> cm.precision()
0.9090909090909091
>>> cm.recall()
0.5
>>> cm.specificity()
0.75
>>> cm.sensitivity()
0.5
>>> cm.f1()
0.6451612903225806
>>> print cm
=========================
Confusion Matrix:

    10  1
    10  3

Accuracy: 0.541666666667
Recall: 0.5
Precision: 0.909090909091
Specificity: 0.75
F-measure: 0.645161290323
=========================

binary_classification.py

Load a yaml file with results of a binary classfication and prints Confusion matrix for that results.

Input file format:

# Languages that can be detected
types: [en, es, pt, it, de]
umbral: 0.5
sample:
  - result:
      en: 0.1
      es: 0.2
      pt: 0.3
      it: 0.6666  #hit! ( 0.6666 > 0.5 )
      de: 0.3
    expected: de
  - result:
      en: 0.2
      es: 0.99 # hit
      pt: 0.98 # hit
      it: 0.4
      de: 0.3
    expected: es

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for confumatrix, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size confumatrix-0.1.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page