我正在对我的数据应用以下过滤器。
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>。还有一个问题,我可以忽略字段而不是删除它们吗?
最佳答案
假设您要对数据运行分类器并忽略已删除的属性,则需要使用 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
关于java - WEKA:如何禁用标记数据的过滤器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5485866/