【问题标题】:Getting classification result from mahout从 mahout 获取分类结果
【发布时间】:2013-01-19 15:32:53
【问题描述】:

我终于可以训练 mahout 分类器了,现在我的问题是如何获得输入文档的目标类别。

为我的文本文档获取目标类别的过程是什么?

【问题讨论】:

    标签: mahout


    【解决方案1】:

    首先,您必须对文本文档 RandomAccessSparseVector 进行矢量化处理。

    一些示例代码供您参考:

        Vector vector = new RandomAccessSparseVector(FEATURES);
        FeatureExtractor fe = new FeatureExtractor();
        HashSet<String> fs = fe.extract(text);
        for (String s : fs) {
            int index = dictionary.get(s);
            vector.setQuick(index, frequency.get(index));
        }
    

    然后,使用 Classifier.classify(Vector) 得到结果。

    【讨论】:

      猜你喜欢
      • 2011-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-01
      • 2014-10-15
      • 1970-01-01
      • 1970-01-01
      • 2013-08-07
      相关资源
      最近更新 更多