質問

I try to classify some instances of a test dataset by using Weka's OneClassClassifier class.

I trained the classifier by using a distinct training dataset. Both the test and training set (arff files) have the same structure of attributes but the test set doesn't contain any class values.
The used classifier options are -tcl myclass (to set my target class).

Running the distributionForInstance(Instance) method, I got the following Error:

  java.lang.ArrayIndexOutOfBoundsException: 3
  # weka.core.DenseInstance.value(weka/core/DenseInstance.java:332)
  # weka.core.AbstractInstance.isMissing(weka/core/AbstractInstance.java:315)
  # weka.filters.unsupervised.attribute.AddValues.input(weka/filters/
    unsupervised/attribute/AddValues.java:315)
  # weka.classifiers.meta.OneClassClassifier.distributionForInstance(weka/
    classifiers/meta/OneClassClassifier.java:1380)

Using other classifiers (e.g. trees.RandomForest, functions.Logistic) my routines are running successfully. What am I doing wrong?

役に立ちましたか?

解決

I just found a solution:

Because of my test set doesn't have any class value assigned, there is no value to load when the 'outlier' class label is added via the unsupervised atrribute AddValues filter.

When I set the instances class value to missing with

instance.setClassMissing();

it works for me and the error disappears.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top