zoukankan      html  css  js  c++  java
  • Classification week6: precision & recall 笔记

    华盛顿大学 machine learning :classification  笔记

    第6周 precision & recall

    1.accuracy 局限性

      我们习惯用 accuracy 评价一个分类器模型的准确程度,accuracy即正确预测的样本数/预测样本总数, 一般情况下这种评价都适用。

      但假设一个这样的二分类器,95%的数据都是 +1 ,分类器直接把所有数据预测为 +1,那这个分类器的accuracy 95%, 很高,但显然这不是个好的分类器。对于这样的数  据,评价一个分类器模型准确程度还需别的评价标准。

    2.True Positive & False Positive & False Negative & True Negative

      对于一个二分类器,预测结果可能有以下几种情况:

      True Positive: 实际为 +1,预测也为 +1。

      False Positive: 实际为 -1,预测为 +1。

      False Negative: 实际为 +1,预测为 -1。

      True Negative: 实际为 -1,预测也为 -1。

      

    3. Accuracy & precision & recall

      Accuracy 表示为:

         

      考虑另外两个评价参数 precision 和 recall。

             

         

    4.Optimistic model & pessimistic model

      

      

    Optimistic model:

      一个预测模型过于乐观, 即几乎对于所有样本都预测为 +1, 这种情况往往发生在数据集多数为 +1 ,且模型过拟合的情况下。

      这种模型的预测结果中, False Negative很少(实际+1 被预测为 -1),False Positive较多(实际-1 被预测为 +1)。即precision 较低, recall较高,Precision 和recall 中主要应注意 precision。

      对于这种模型,需要注意减少false positive 的数量, 即:

      计算Cost时false positive 与 false negative权重不同,false positive 的权重应更高;

      提高预测为 +1 的confidence level,即提高判断为+1的阈值(+1 if probability >= threshold else -1),模型需要在更有把握的时候才能预测为 +1。

     

    pessimistic model:

      一个预测模型过于悲观, 即只有在非常肯定的情况下才会预测为 +1,

      这种模型的预测结果中, False Negative很多(实际+1 被预测为 -1),False Positive较少(实际-1 被预测为 +1)。即 precision较高, recall较低,应主要注意 recall。

      对于这种模型,需要注意减少false negative 的数量, 即

      计算Cost时提高false negative 的权重。

      降低预测为 +1 的confidence level。

    5. 用Precision & recall评价模型好坏

      显然,最理想的模型 precision、recall 都为1,然而实际情况中面临着 precision & recall 之间的权衡问题,precision 和recall 往往是此消彼长,例如有两个分类器模型A 和B,如下图所示,考虑到precision 和 recall, 哪个模型更好?

      

    一个评价方法是:比较曲线下的面积大小(area-under-the-curve, AUC)。以这种方法进行比较,显然B分类器更好。

  • 相关阅读:
    Java高级之类结构的认识
    14.8.9 Clustered and Secondary Indexes
    14.8.4 Moving or Copying InnoDB Tables to Another Machine 移动或者拷贝 InnoDB 表到另外机器
    14.8.3 Physical Row Structure of InnoDB Tables InnoDB 表的物理行结构
    14.8.2 Role of the .frm File for InnoDB Tables InnoDB 表得到 .frm文件的作用
    14.8.1 Creating InnoDB Tables 创建InnoDB 表
    14.7.4 InnoDB File-Per-Table Tablespaces
    14.7.2 Changing the Number or Size of InnoDB Redo Log Files 改变InnoDB Redo Log Files的数量和大小
    14.7.1 Resizing the InnoDB System Tablespace InnoDB 系统表空间大小
    14.6.11 Configuring Optimizer Statistics for InnoDB 配置优化统计信息用于InnoDB
  • 原文地址:https://www.cnblogs.com/smartweed/p/8617842.html
Copyright © 2011-2022 走看看