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>。还有一个问题,我可以忽略字段而不是删除它们吗?

4

1 回答 1

1

假设您要对数据运行分类器并忽略您一直在删除的属性,您希望将FilteredClassifier与 Remove 过滤器一起使用。

// 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 回答