0

I'm using Weka for text classification task. I created my data.arff File. It contains two attributes:

  1. text attribute
  2. class attribute

Then, the generated ARFF file is processed with the StringToWordVector:

java weka.filters.unsupervised.attribute.StringToWordVector -i data/weather.arff -o data/out.arff Then, NaiveBayes is used: java weka.classifiers.bayes.NaiveBayes -t data/out.arff -K

I have this problem:

weka.core.UnsupportedAttributeTypeException: weka.classifiers.bayes.NaiveBayes: Cannot handle numeric class! at weka.core.Capabilities.test(Capabilities.java:954) at weka.core.Capabilities.test(Capabilities.java:1110) at weka.core.Capabilities.test(Capabilities.java:1023) at weka.core.Capabilities.testWithFail(Capabilities.java:1302) at weka.classifiers.bayes.NaiveBayes.buildClassifier(NaiveBayes.java:213) at weka.classifiers.Evaluation.evaluateModel(Evaluation.java:1076) at weka.classifiers.Classifier.runClassifier(Classifier.java:312) at weka.classifiers.bayes.NaiveBayes.main(NaiveBayes.java:944) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at weka.gui.SimpleCLIPanel$ClassRunner.run(SimpleCLIPanel.java:265)

Could anyone help me? I'm stuck at this level.

4

1 回答 1

0

这正是它所说的——它不能处理类变量的数值。如果您将类变量声明为字符串,请将数值更改为其等效的文本值。

于 2012-03-23T07:21:53.963 回答