Confusion Matrix is not so confusing

栏目: IT技术 · 发布时间: 4年前

Confusion Matrix is not so confusing

Confusion Matrix

Confusion Matrixis a matrix that illustrates the performance of a classification model when exposed to unseen data. This matrix helps us to identify how the model is performing on test set. From this matrix, many other scores are calculated such as Accuracy, Recall, Precision, F1-score, etc. It is important one should know where to use which type of score as it depends on the application.

There are two classes: Class 1 and Class 2

Class 1:Positive

Class 2: Negative

Positive: Observation is True (eg. Picture is a dog)

Negative: Observation is False (eg. Picture is not a dog)

T.P.(True Positive): Truth and Prediction both are Positive

T.N.(True Negative): Truth and Prediction both are Negative

F.P.(False Positive): Truth is Negative but Prediction is Positive

F.N.(False Negative): Truth is Positive but Prediction is Negative

Accuracy:

Accuracy is the ratio of sum of True Positive(T.P.) and True Negative(T.N.) to the sum of the matrix elements.

Confusion Matrix is not so confusing

Precision:

Precision is defined as the ratio of True Positive(T.P) to the sum of True Positive(T.P) and False Positive(F.P)

Confusion Matrix is not so confusing

Recall:

Recall is defined as the ratio of True Positive(T.P) to the sum of True Positive(T.P) and False Negative(F.N)

Confusion Matrix is not so confusing

High recall, low precision:This means that most of the positive examples are correctly recognized (low FN) but there are a lot of false positives.

Low recall, high precision:This shows that we miss a lot of positive examples (high FN) but those we predict as positive are indeed positive (low FP)

F1-score:

Since we have two measures (Precision and Recall) it helps to have a measurement that represents both of them. We calculate an F-measure which uses Harmonic Mean in place of Arithmetic Mean as it punishes the extreme values more.

The F-Measure will always be nearer to the smaller value of Precision or Recall.

Confusion Matrix is not so confusing

Exercise

Confusion Matrix is not so confusing

Accuracy

Accuracy = (TP + TN) / (TP + TN + FP + FN) = (100 + 50) /(100 + 5 + 10 + 50) = 0.90

Precision

Precision tells us about when it predicts yes, how often is it correct.

Precision = TP / (TP + FP)=100/ (100+10) = 0.91

Recall

Recall gives us an idea about when it’s actually yes, how often does it predict yes.

Recall = TP / (TP + FN) = 100 / (100 + 5) = 0.95

F-score

F1-score = (2 * Recall * Precision) / (Recall + Presision) = (2 * 0.95 * 0.91) / (0.91 + 0.95) = 0.9
Got any questions?

GitHub

LinkedIn

Email: amarmandal2153@gmail.com

Thank youuuu…


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

创业时代

创业时代

付遥 / 中信出版社 / 2015-7 / 39.8元

香港人郭鑫年酷爱赛车,在驾车穿越隧道的时候,因为收发短信发生意外,他从被撞得破烂的车里爬出来时,兴奋地高喊:我有一个伟大的想法,手机上的对讲机,将要改变世界!他随即辞职来到北京,开始艰难的创业历程。 移动技术迅猛发展,正在颠覆互联网行业,郭鑫年误打误撞,对讲机用户数量急增,竟成为移动互联网的明星,他也因此置身于风口浪尖。三大互联网巨头为了抢夺手机入口大打出手,无不希望争夺这张通往未来移动市场......一起来看看 《创业时代》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具