本文整理匯總了Java中weka.filters.Filter.getOutputFormat方法的典型用法代碼示例。如果您正苦於以下問題:Java Filter.getOutputFormat方法的具體用法?Java Filter.getOutputFormat怎麽用?Java Filter.getOutputFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類weka.filters.Filter
的用法示例。
在下文中一共展示了Filter.getOutputFormat方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: useFilter
import weka.filters.Filter; //導入方法依賴的package包/類
/**
* Filters an entire set of instances through a filter and returns the new
* set.
*
* @param data the data to be filtered
* @param filter the filter to be used
* @return the filtered set of data
* @throws Exception if the filter can't be used successfully
*/
public static Instances useFilter(Instances data, Filter filter)
throws Exception {
/*
* System.err.println(filter.getClass().getName() + " in:" +
* data.numInstances());
*/
for (int i = 0; i < data.numInstances(); i++) {
filter.input(data.instance(i));
}
filter.batchFinished();
Instances newData = filter.getOutputFormat();
Instance processed;
while ((processed = filter.output()) != null) {
newData.add(processed);
}
/*
* System.err.println(filter.getClass().getName() + " out:" +
* newData.numInstances());
*/
return newData;
}
示例2: setFilter
import weka.filters.Filter; //導入方法依賴的package包/類
@Override
public void setFilter(Filter filter) {
super.setFilter(filter);
if (!(filter instanceof PreconstructedFilter)) {
throw new IllegalArgumentException(
"The filter must be a Preconstructed one!");
} else if (!((PreconstructedFilter) filter).isConstructed()) {
throw new IllegalArgumentException("PreconstructedFilter: "
+ filter.getClass().getName() + " has not been initialized!");
}
m_FilteredInstances = filter.getOutputFormat();
}
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:15,代碼來源:PreconstructedFilteredClusterer.java