(决策分析思考)Decision Analytic Thinking

主要内容:

  1. 准确度评判标准的缺陷
  2. The Confusion Matrix
  3. 非均衡类别的问题
  4. Data-Analytic Thinking
  5. 分析框架:期望值
  6. 模型评判的基准(Baseline)

 

———————————————————————————————————————————————

 

(一)准确度评判标准的缺陷

 

  1.  
  2. 需要肯定的是准确度(plain accuracy)评判标准比较流行且计算方便
  3. 在一些实际的案例中,准确度评判的效果强差人意(过于简单)

  • 容易受到非均衡类别的影响
简单的例子:
例如有两个类别的东西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


在Confusion Matrix 中,对角线为正确预测的案例,非对角线则为预测错误

其中False positives 为 将 negative 的案例错误地归结为positives

其中False negatives 为 将  positives 的案例错误地归结为negatives

 

(三)非均衡类别问题

 

现实中我们常常会遇到类别非均衡的例子(例如诈骗检测、特定顾客的定位等等),简单地说,我们有时需要关注那些“小概率”事件。

类别的非均衡导致我们分析的样本成为偏态分布,而偏态会在很大程度上影响‘准确度评判标准’(之前的例子已经说明了其影响机制,‘准确度评判标准’会产生误导)。在这样的情况下,我们需要关于样本数据的更多信息以进一步分析。

例子:

假设有模型A、B,作用于同一均衡类别的数据后得到如下结果

         

churn     

not churn     

Y

500

200

N

0

300

        

churn     

not churn     

Y

300

0

N

200

500

Confusion matrix of A

 Confusion matrix of B

 

两个模型均正确分类了80%的数据,但是他们的表现却截然不同,A模型偏向于将 False churn 、B模型偏向于False not churn

 

假如这两个模型应用于非均衡类别样本那么他们的模型之间的准确率变化将非常大,如下图所示

 

 

 

(四)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   


Cost-Benefit Matrix

 计算过程:


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)

 

  1. 最大化预测准确率往往不是一个合适的目标
  2. Classification 的 baseline 可以是 Majority Classifier
  3. 在较多的机器学习研究中决策树桩(Decision Stump)往往是较好的基准
  4. 有的时候我们能利用领域知识在预测作为基准

注:Decision Stump: a decision tree with only one internal node, the root nodemostinformativefeature


 

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值