0

次のフィルターをデータに適用しています。

string[] options = new string[2];
options[0] = "-R";
options[1] = "1-2";

Remove remove = new Remove();  // new instance of filter
remove.setOptions(options);

remove.setInputFormat(train);
train = Filter.useFilter(train, remove);  
unlabeled = Filter.useFilter(unlabeled, remove);  

ただし、最後にラベル付きデータを印刷するときに、削除されたフィールドを追加したいと思います。

列を再度追加するにはどうすればよいですか?

ありがとう

PS>. もう 1 つ質問があります。フィールドを削除するのではなく、無視することはできますか?

4

1 に答える 1

1

データに対して分類子を実行し、削除した属性を無視すると仮定すると、Remove フィルターでFilteredClassifierを使用する必要があります。

// Untested Java, I use Weka through JRuby
NaiveBayes naiveBayes = new NaiveBayes();
Remove remove = new Remove();
remove.setOptions(Utils.splitOptions("-R 1-2"));
FilteredClassifier model = new FilteredClassifier(naiveBayes, remove);

// Use model to classify as normal
于 2011-04-01T03:06:59.097 に答える