Skip to Content
Python文本分析
book

Python文本分析

by Jens Albrecht, Sidharth Ramachandran, Christian Winkler
August 2022
Intermediate to advanced
441 pages
11h 26m
Chinese
China Electric Power Press Ltd.
Content preview from Python文本分析
文本分类算法
|
191
accuracy 0.87 9006
macro avg 0.40 0.24 0.26 9006
weighted avg 0.81 0.87 0.83 9006
根据我们的计算和前面的分类报告,有一个问题非常明显:
P3
类别的召回率和精确
率非常高,而其他类别的这些值却很低,在某些情况下(
P5
)甚至为
0
。该模型的
整体准确率为
88%
,但即使永远预测
P3
,准确率也能达到
88%
。这表明,我们的模
型并没有学习到太多东西,只不过是在预测时选择了多数类而已。这充分说明了,
在模型评估期间,我们必须分析多个指标,而不能仅依靠准确性。
类别不平衡
导致模型这种行为的原因是
priority
中的类别不平衡(我们前面也观察到了)。
priority
为
P3
的错误有将近
36000
个,但其他类别的错误数量只有
4000
个,有些类
别甚至更少。这意味着,当我们训练模型时,它只能学习到
P3
类别的特征。
为了克服类别不平衡的问题,我们可以采取几种技巧。这些技巧主要分为上采样和
下采样两种。上采样指的是,人为地增加少数类(我们示例中所有非
P3
类别)的
观测数量。这些方法多种多样,有些只是简单地添加多个复制样本,而有些则是采
用
SMOTE
之类的方法生成新观测。
注
1
下采样指的是减少多数类(我们示例中的
P3
类别)的观测数量。我们选择针对
P3
类别进行随机下采样,将
P3
的观测数量降
至与其他类别接近的水平: ...
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

工程战略的制定

工程战略的制定

Will Larson
Python实用技能学习指南

Python实用技能学习指南

Posts & Telecom Press, Robert Smallshire, Austin Bingham
精益AI

精益AI

Lomit Patel
Excel金融建模

Excel金融建模

Posts & Telecom Press, Shmuel Oluwa

Publisher Resources

ISBN: 9787519864446