【问题标题】:What is the difference between CountVectorizer(binary=True) and n CountVectorizer(binary=False) in sklearnsklearn中的CountVectorizer(binary=True)和n CountVectorizer(binary=False)有什么区别
【发布时间】:2019-11-08 10:14:19
【问题描述】:

我运行脚本时定义了 ngram_vectorizer = CountVectorizer(binary=True) 和 ngram_vectorizer = CountVectorizer(binary=False)

两者的混淆矩阵的结果是不同的。可以帮助我理解二进制文件的作用吗?

【问题讨论】:

    标签: python vector nlp n-gram countvectorizer


    【解决方案1】:

    如果您设置binary=True,则 CountVectorizer 不再使用术语/标记的计数。如果文档中存在令牌,则为 1,如果不存在,则为 0,无论其出现频率如何。所以你将只处理二进制值。默认情况下,binary=False

    usage examples here

    【讨论】:

      猜你喜欢
      • 2016-12-06
      • 2021-02-09
      • 2016-05-14
      • 2018-03-18
      • 2018-03-20
      • 2015-05-31
      • 2015-07-30
      • 2017-06-24
      • 1970-01-01
      相关资源
      最近更新 更多