PyCM
| File:PyCM Logo.png | |
| Original author(s) | Sepand Haghighi, Alireza Zolanvari |
|---|---|
| Initial release | January 23, 2018[1] |
| Stable release | 2.2
/ May 30, 2019[2] |
| Repository | https://github.com/sepandhaghighi/pycm |
| Written in | Python |
| Engine | |
| Operating system | Linux, macOS, Windows |
| Type | Machine Learning, Statistical classification |
| License | MIT License |
| Website | www |
Search PyCM on Amazon.
PyCM is an open-source machine learning library for the Python programming language.[3] PyCM is a machine learning library supporting different statistical parameters for confusion matrix analyzing. This library has the ability to recommend most related parameters according to classification type and also comparing different classification models by use of several overall and class based benchmarks.[4] [5] [6] [7]
Some applications that depend on PyCM :
- CLaF : Open-Source Clova Language Framework [8]
- CrowdED : Guideline for designing optimal crowdsourcing experiments [9]
- CHERVIL : A detection algorithm for expression features that correspond to previous viral infection [10]
Examples
- ConfusionMatrix
>>> from pycm import *
>>> y_a = [1,2,2,1,2,1,1,2,0,0,1,1,2]
>>> y_p = [1,2,2,2,2,1,2,2,0,0,1,1,1]
>>> cm = ConfusionMatrix(y_a,y_p)
>>> cm.classes
[0, 1, 2]
>>> cm.table
{0: {0: 2, 1: 0, 2: 0}, 1: {0: 0, 1: 4, 2: 2}, 2: {0: 0, 1: 1, 2: 4}}
>>> print(cm)
Predict 0 1 2
Actual
0 2 0 0
1 0 4 2
2 0 1 4
Overall Statistics :
95% CI (0.5402,0.99827)
ACC Macro 0.84615
AUNP 0.80357
AUNU 0.84563
Bennett S 0.65385
CBA 0.77778
Chi-Squared 15.83111
Chi-Squared DF 4
Conditional Entropy 0.70149
Cramer V 0.78031
Cross Entropy 1.48072
F1 Macro 0.81818
F1 Micro 0.76923
Gwet AC1 0.66595
Hamming Loss 0.23077
Joint Entropy 2.16198
KL Divergence 0.02023
Kappa 0.62857
Kappa 95% CI (0.25993,0.99721)
Kappa No Prevalence 0.53846
Kappa Standard Error 0.18808
Kappa Unbiased 0.62679
Lambda A 0.57143
Lambda B 0.57143
Mutual Information 0.75899
NIR 0.46154
Overall ACC 0.76923
Overall CEN 0.32224
Overall J (2.14286,0.71429)
Overall MCC 0.63462
Overall MCEN 0.40138
Overall RACC 0.3787
Overall RACCU 0.38166
P-Value 0.02486
PPV Macro 0.82222
PPV Micro 0.76923
Pearson C 0.74101
Phi-Squared 1.21778
RCI 0.51968
RR 4.33333
Reference Entropy 1.46048
Response Entropy 1.46048
SOA1(Landis & Koch) Substantial
SOA2(Fleiss) Intermediate to Good
SOA3(Altman) Good
SOA4(Cicchetti) Good
SOA5(Cramer) Strong
SOA6(Matthews) Moderate
Scott PI 0.62679
Standard Error 0.11685
TPR Macro 0.82222
TPR Micro 0.76923
Zero-one Loss 3
Class Statistics :
Classes 0 1 2
ACC(Accuracy) 1.0 0.76923 0.76923
AGM(Adjusted geometric mean) 1.0 0.79135 0.76523
AM(Difference between automatic and manual classification) 0 -1 1
AUC(Area under the roc curve) 1.0 0.7619 0.775
AUCI(AUC value interpretation) Excellent Good Good
BCD(Bray-Curtis dissimilarity) 0.0 0.03846 0.03846
BM(Informedness or bookmaker informedness) 1.0 0.52381 0.55
CEN(Confusion entropy) 0 0.38083 0.38083
DOR(Diagnostic odds ratio) None 12.0 12.0
DP(Discriminant power) None 0.59498 0.59498
DPI(Discriminant power interpretation) None Poor Poor
ERR(Error rate) 0.0 0.23077 0.23077
F0.5(F0.5 score) 1.0 0.76923 0.68966
F1(F1 score - harmonic mean of precision and sensitivity) 1.0 0.72727 0.72727
F2(F2 score) 1.0 0.68966 0.76923
FDR(False discovery rate) 0.0 0.2 0.33333
FN(False negative/miss/type 2 error) 0 2 1
FNR(Miss rate or false negative rate) 0.0 0.33333 0.2
FOR(False omission rate) 0.0 0.25 0.14286
FP(False positive/type 1 error/false alarm) 0 1 2
FPR(Fall-out or false positive rate) 0.0 0.14286 0.25
G(G-measure geometric mean of precision and sensitivity) 1.0 0.7303 0.7303
GI(Gini index) 1.0 0.52381 0.55
GM(G-mean geometric mean of specificity and sensitivity) 1.0 0.75593 0.7746
IBA(Index of balanced accuracy) 1.0 0.46259 0.63
IS(Information score) 2.70044 0.79355 0.79355
J(Jaccard index) 1.0 0.57143 0.57143
LS(Lift score) 6.5 1.73333 1.73333
MCC(Matthews correlation coefficient) 1.0 0.53675 0.53675
MCCI(Matthews correlation coefficient interpretation) Very Strong Moderate Moderate
MCEN(Modified confusion entropy) 0 0.45872 0.45872
MK(Markedness) 1.0 0.55 0.52381
N(Condition negative) 11 7 8
NLR(Negative likelihood ratio) 0.0 0.38889 0.26667
NLRI(Negative likelihood ratio interpretation) Good Poor Poor
NPV(Negative predictive value) 1.0 0.75 0.85714
OP(Optimized precision) 1.0 0.64423 0.73697
P(Condition positive or support) 2 6 5
PLR(Positive likelihood ratio) None 4.66667 3.2
PLRI(Positive likelihood ratio interpretation) None Poor Poor
POP(Population) 13 13 13
PPV(Precision or positive predictive value) 1.0 0.8 0.66667
PRE(Prevalence) 0.15385 0.46154 0.38462
Q(Yule Q - coefficient of colligation) None 0.84615 0.84615
RACC(Random accuracy) 0.02367 0.17751 0.17751
RACCU(Random accuracy unbiased) 0.02367 0.17899 0.17899
TN(True negative/correct rejection) 11 6 6
TNR(Specificity or true negative rate) 1.0 0.85714 0.75
TON(Test outcome negative) 11 8 7
TOP(Test outcome positive) 2 5 6
TP(True positive/hit) 2 4 4
TPR(Sensitivity, recall, hit rate, or true positive rate) 1.0 0.66667 0.8
Y(Youden index) 1.0 0.52381 0.55
dInd(Distance index) 0.0 0.36266 0.32016
sInd(Similarity index) 1.0 0.74356 0.77362
- Compare
>>> cm1 = ConfusionMatrix(matrix={0:{0:2,1:50,2:6},1:{0:5,1:50,2:3},2:{0:1,1:7,2:50}})
>>> cm2 = ConfusionMatrix(matrix={0:{0:50,1:2,2:6},1:{0:50,1:5,2:3},2:{0:1,1:55,2:2}})
>>> cp = Compare({"cm1":cm1,"cm2":cm2})
>>> print(cp)
Best : cm1
Rank Name Class-Score Overall-Score
1 cm1 4.15 1.48333
2 cm2 2.75 0.95
>>> cp.best
pycm.ConfusionMatrix(classes: [0, 1, 2])
>>> cp.sorted
['cm1', 'cm2']
>>> cp.best_name
'cm1'
See also
- Confusion matrix
- Statistical classification
- Machine learning
- Multiclass classification
- Binary classification
References
- ↑ Sepand Haghighi; Jasemi, Masoomeh; Shaahin Hessabi (2018). "0.1". doi:10.5281/zenodo.1157173. Retrieved 13 May 2019.
- ↑ "2.2". Github. Retrieved 30 May 2019.
- ↑ Haghighi, Sepand; Jasemi, Masoomeh; Hessabi, Shaahin; Zolanvari, Alireza (2018). "PyCM: Multiclass confusion matrix library in Python". The Journal of Open Source Software. 3 (25): 729. Bibcode:2018JOSS....3..729H. doi:10.21105/joss.00729.
- ↑ "PyCM in Researchgate". Researchgate. Retrieved 13 May 2019.
- ↑ "PyCM in Semanticscholar". Semanticscholar. Retrieved 18 March 2019.
- ↑ "PyCM". Harvard University. Bibcode:2018JOSS....3..729H.
- ↑ "A Bibliography of Publications about the Python Scripting and Programming Language" (PDF). University of Utah. Retrieved 27 May 2019.
- ↑ "CLaF: Open-Source Clova Language Framework". Github. Retrieved 28 May 2019.
- ↑ CrowdED: Guideline for Optimal Crowdsourcing Experimental Design. Companion Proceedings of the The Web Conference 2018. doi:10.1145/3184558.3191543. ISBN 9781450356404. Retrieved 28 May 2019. Search this book on
External links
| This scientific software article is a stub. You can help EverybodyWiki by expanding it. |
This article "PyCM" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:PyCM. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
