Skip to Content
Python机器学习基础教程
book

Python机器学习基础教程

by Andreas C. Müller, Sarah Guido
January 2018
Intermediate to advanced
301 pages
8h 54m
Chinese
Posts & Telecom Press
Content preview from Python机器学习基础教程
230
5
我们得到等于
1.0
的完美
AUC
。这意味着根据决策函数,所有正类点的排名要高于所有反
类点。换句话说,利用正确的阈值,这个模型可以对所有数据进行完美分类!
10
知道这一
点,我们可以调节这个模型的阈值并得到很好的预测结果。如果我们仅使用精度,那么将
永远不会发现这一点。
因此,我们强烈建议在不平衡数据上评估模型时使用
AUC
。但请记住,
AUC
没有使用默
认阈值,因此,为了从高
AUC
的模型中得到有用的分类结果,可能还需要调节决策阈值。
5.3.3
 多分类指标
前面我们已经深入讨论了二分类任务的评估,下面来看一下对多分类问题的评估指标。多
分类问题的所有指标基本上都来自于二分类指标,但是要对所有类别进行平均。多分类的
精度被定义为正确分类的样本所占的比例。同样,如果类别是不平衡的,精度并不是很
好的评估度量。想象一个三分类问题,其中
85%
的数据点属于类别
A
10%
属于类别
B
5%
属于类别
C
。在这个数据集上
85%
的精度说明了什么?一般来说,多分类结果比二分
类结果更加难以理解。除了精度,常用的工具有混淆矩阵和分类报告,我们在上一节二分
类的例子中都见过。下面我们将这两种详细的评估方法应用于对 digits 数据集中
10
种不
同的手写数字进行分类的任务:
In[63]:
from sklearn.metrics import accuracy_score
X_train, X_test, y_train, y_test = train_test_split(
digits.data, digits.target, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

数据驱动力:企业数据分析实战

数据驱动力:企业数据分析实战

Carl Anderson
Python应用开发指南

Python应用开发指南

Posts & Telecom Press, Ninad Sathaye
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey

Publisher Resources

ISBN: 9787115475619