2011-03-30 4 views
0

내 데이터에 다음 필터를 적용하고 있습니다.WEKA : 레이블이 지정된 데이터에서 필터를 비활성화하는 방법은 무엇입니까?

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); 

그러나 마지막에 레이블이 지정된 데이터를 인쇄 할 때 제거 된 필드를 추가하고 싶습니다.

어떻게 열을 다시 추가 할 수 있습니까?

감사합니다.

피씨> 한가지 더 질문합니다. 필드를 지우지 않고 무시할 수 있습니까?

답변

1

데이터에 분류기를 실행하고 제거한 속성을 무시한다고 가정하면 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 
관련 문제