一般来说,TF-IDF 什么时候会降低精度? [英] In general, when does TF-IDF reduce accuracy?

查看:40
本文介绍了一般来说,TF-IDF 什么时候会降低精度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用朴素贝叶斯模型将包含 200000 条评论的语料库训练成正面和负面评论,我注意到执行 TF-IDF 实际上降低了准确度(在 50000 条评论的测试集上进行测试时)大约 2%.所以我想知道 TF-IDF 是否对它所使用的数据或模型有任何潜在的假设,即任何使用它会降低准确性的情况?

I'm training a corpus consisting of 200000 reviews into positive and negative reviews using a Naive Bayes model, and I noticed that performing TF-IDF actually reduced the accuracy (while testing on test set of 50000 reviews) by about 2%. So I was wondering if TF-IDF has any underlying assumptions on the data or model that it works with, i.e. any cases where accuracy is reduced by the use of it?

推荐答案

TF*IDF 的 IDF 组件在某些情况下会损害您的分类准确性.

The IDF component of TF*IDF can harm your classification accuracy in some cases.

假设以下人工的、简单的分类任务,为了说明:

Let suppose the following artificial, easy classification task, made for the sake of illustration:

  • A 类:包含玉米"一词的文本
  • B 类:不包含玉米"一词的文本

现在假设在 A 类中,您有 100 000 个示例,而在 B 类中,您有 1000 个示例.

Suppose now that in Class A, you have 100 000 examples and in class B, 1000 examples.

TFIDF 会发生什么?玉米的逆文档频率会很低(因为几乎所有文档中都会找到),特征'玉米'会得到一个很小的TFIDF,这是分类器使用的特征的权重.显然,玉米"是这个分类任务的最佳特征.这是一个示例,其中 TFIDF 可能会降低您的分类准确度.更笼统地说:

What will happen to TFIDF? The inverse document frequency of corn will be very low (because it is found in almost all documents), and the feature 'corn' will get a very small TFIDF, which is the weight of the feature used by the classifier. Obviously, 'corn' was THE best feature for this classification task. This is an example where TFIDF may reduce your classification accuracy. In more general terms:

  • 当存在类不平衡时.如果你在一个类中有更多的实例,那么频繁类的好词特征有可能具有较低的 IDF,因此它们的最佳特征将具有较低的权重
  • 当您有对某一类(在该类的大多数文档中发现的词)非常有预测性的高频词时

这篇关于一般来说,TF-IDF 什么时候会降低精度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆