Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

贝叶斯模型训练文本分类模型时,选中特征数:0 / 380 = 0.00% #920

Closed
1 task done
luoxianjiao opened this issue Aug 15, 2018 · 1 comment
Closed
1 task done

Comments

@luoxianjiao
Copy link

注意事项

请确认下列注意事项:

  • 我已仔细阅读下列文档,都没有找到答案:
  • 我已经通过Googleissue区检索功能搜索了我的问题,也没有找到答案。
  • 我明白开源社区是出于兴趣爱好聚集起来的自由社区,不承担任何责任或义务。我会礼貌发言,向每一个帮助我的人表示感谢。
  • 我在此括号内输入x打钩,代表上述事项确认完毕。

版本号

当前最新版本号是:hanlp-1.6.7.jar
我使用的版本是:hanlp-1.6.7.jar

我的问题

我使用朴素贝叶斯模型训练进行文本分类时,我自己训练两个种类:商票、体育,每个种类训练5个句子,结果日志显示:
正在构造训练数据集...[商票]...50.00%...[体育]...100.00%...耗时 260 ms 加载完毕
原始数据集大小:10
使用卡方检测选择特征中...耗时 1 ms,选中特征数:0 / 380 = 0.00%
用训练得到的模型测试不同种类的文本时,每次都是体育,这是怎么回事呢?是训练的素材不够导致的吗?

复现问题

步骤

  1. 首先……
  2. 然后……
  3. 接着……

触发代码

    public void testIssue1234() throws Exception
    {
        CustomDictionary.add("用户词语");
        System.out.println(StandardTokenizer.segment("触发问题的句子"));
    }

期望输出

期望输出

实际输出

实际输出

其他信息

@hankcs hankcs closed this as completed in c1a6d5d Aug 18, 2018
@hankcs
Copy link
Owner

hankcs commented Aug 18, 2018

  1. 的确,当特征都无法通过卡方检测时,不应该全部过滤。现在已经改进了。
  2. 这么少的样本无法构成机器学习,训练出的模型没有多大用处。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants