(决策分析思考)Decision Analytic Thinking
2015-09-05 17:16
232 查看
主要内容:
准确度评判标准的缺陷The Confusion Matrix
非均衡类别的问题
Data-Analytic Thinking
分析框架:期望值
模型评判的基准(Baseline)
———————————————————————————————————————————————
(一)准确度评判标准的缺陷
需要肯定的是准确度(plain accuracy)评判标准比较流行且计算方便
在一些实际的案例中,准确度评判的效果强差人意(过于简单)
容易受到非均衡类别的影响
简单的例子:
例如有两个类别的东西A 和 B ,他们的比例为 A:B = 999:1 ,A 是positive ,B 是 Negative,只要我们预测所有的样本都是Positive,那么我们模型的准确率便可以达到99.9% 。(很显然,这样的准确率是没有意义的,如果能准确预测出哪些是Negative 才是我们的主要目标)
均衡地对待 false Positives 和 false Negatives 【定义见(二)】 —> 涉及到Cost的问题
简单的例子:
在癌症检测中,我们需要有区别地对待误诊为癌症【false Negatives】和误诊为没有癌症【false Positives】,很显然两者的代价相差巨大,如果仅仅用准确度度量会产生很严重的后果
(二)The Confusion Matrix
定义:Confusion Matrix 是一个NxN的矩阵,矩阵的列标题是实际的类别,矩阵的行标题是预测的类别【二维Confusion Matrix 的例子 】
The layout of a 2 × 2 confusion matrix showing the names of the correct predictions (main diagonal) and errors (off-diagonal) entries.
p(ositives) | n(egatives) | |
Y(es) | True positives | False positives |
N(o) | False negatives | True negatives |
其中False positives 为 将 negative 的案例错误地归结为positives
其中False negatives 为 将 positives 的案例错误地归结为negatives
(三)非均衡类别问题
现实中我们常常会遇到类别非均衡的例子(例如诈骗检测、特定顾客的定位等等),简单地说,我们有时需要关注那些“小概率”事件。类别的非均衡导致我们分析的样本成为偏态分布,而偏态会在很大程度上影响‘准确度评判标准’(之前的例子已经说明了其影响机制,‘准确度评判标准’会产生误导)。在这样的情况下,我们需要关于样本数据的更多信息以进一步分析。
例子:
假设有模型A、B,作用于同一均衡类别的数据后得到如下结果
|
| ||||||||||||||||||
Confusion matrix of A | Confusion matrix of B |
假如这两个模型应用于非均衡类别样本那么他们的模型之间的准确率变化将非常大,如下图所示
(四)Data-Analytic Thinking
我们将数据科学应用到实际问题中时,我们需要考虑,问题中什么最为重要,我们的目标是什么等各种问题,而不仅仅是模型效果例如下面的对话:
Analyst : Our model is good based on the mean-squared error
Boss : mean-squared error of what?
Analyst: the value of the target variable, which is the number of stars that a user would give as a rating for the movie
Boss : Why is the mean-squared-error on the predicted number of stars an appropriate metric for our recommendation problem?
Boss : Is it meaningful ?
Boss : Is there a better metric ?
在实际工作中,很多分析人士只会使用那些在学校课堂中学习到的度量方式,而没有自己的思考,这点相当可悲。
(五)分析框架:期望值
思考下面的问题‘targeting Marketing’:对每个客户个体而言,他们对于刺激的反馈概率往往很低,一般1%或2%左右,如果我们选取50%为决策阈值,那么我们将会得到结论“没有人会对刺激有反应”
如果改用期望值,我们可以得到
据此我们能做出较好的决策
二维情况下
利用条件概率
得到计算公式
注:
例子:
Confusion Matrix、
p | n | |
Y | 56 | 7 |
N | 5 | 42 |
计算过程:
T = 110 | |
P = 61 | N = 49 |
p(p) = 0.55 | p(n) = 0.45 |
tp rate = 56/61 = 0.92 | fp rate = 7/49 = 0.14 |
fn rate = 5/61 = 0.08 | tn rate = 42/49 = 0.86 |
、
PS: 其他一些度量标准
The metrics Precision and Recall are often used, especially in text classification and information retrieval. Recall is the same as true positive rate, while precision is TP/(TP + FP), which is the accuracy
over the cases predicted to be positive.
、
(六)模型评判的基准(Baseline)
最大化预测准确率往往不是一个合适的目标Classification 的 baseline 可以是 Majority Classifier
在较多的机器学习研究中决策树桩(Decision Stump)往往是较好的基准
有的时候我们能利用领域知识在预测作为基准
注:Decision Stump: a decision tree with only one internal node, the root node(mostinformativefeature)
In real-world domains simplistic measures rarely capture what is actually important for the problem at hand, and often mislead. Instead, the data scientist should give careful thought to how the
model will be used in practice and devise an appropriate metric.
相关文章推荐
- 中国联通SGIP接口
- 操作系统文件管理
- Foxmail如何导入旧数据【7.1版本以上】
- linux进程管理
- websockete
- jieba中文分词源码分析(三)
- 页面之间的卷滚切换效果
- Low Memory Killer(低内存管理)
- 方法反射的基本操作
- Hibernate Validator实践之一 入门篇
- android app崩溃日志收集
- mac下为eclipse安装svn插件
- POJ C++程序设计 编程题#1 List
- 怎么设置win7一直以管理员身份运行
- php email邮箱正则验证
- Linux系统管理-(13)-网络配置查看ss命令
- 中国移动CMPP接口
- 黑马程序员——面向对象(多态+接口实现)-第18天
- 让lua支持base64和md5 - xu_ya_fei的专栏 - 博客频道 - CSDN.NET
- 百度Web富文本编辑器ueditor在ASP.NET MVC3项目中的使用说明