當前位置: 首頁>>代碼示例>>Java>>正文


Java Filter.setInputFormat方法代碼示例

本文整理匯總了Java中weka.filters.Filter.setInputFormat方法的典型用法代碼示例。如果您正苦於以下問題:Java Filter.setInputFormat方法的具體用法?Java Filter.setInputFormat怎麽用?Java Filter.setInputFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在weka.filters.Filter的用法示例。


在下文中一共展示了Filter.setInputFormat方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: predictInstanceDistribution

import weka.filters.Filter; //導入方法依賴的package包/類
public double[] predictInstanceDistribution(Reader reader) throws Exception {
    // assume that the file contains only 1 instance
    // load instances
    Instances data = new Instances(reader);
    // remove reportID attribute
    String[] options = weka.core.Utils.splitOptions("-R 1");  // removes the first attribute in instances (should be the document id?)
    String filterName = "weka.filters.unsupervised.attribute.Remove";
    Filter filter = (Filter) Class.forName(filterName).newInstance();
    if (filter instanceof OptionHandler) {
        ((OptionHandler) filter).setOptions(options);
    }
    filter.setInputFormat(data);
    // make the instances
    Instances unlabeled = Filter.useFilter(data, filter);

    double[][] dist = this.predictDataDistribution(unlabeled);
    return dist[0];
}
 
開發者ID:NLPReViz,項目名稱:emr-nlp-server,代碼行數:19,代碼來源:CertSVMPredictor.java

示例2: trainModelFromFile

import weka.filters.Filter; //導入方法依賴的package包/類
public void trainModelFromFile(String fnTrainData) throws Exception {
    // load instances
    Instances data = new Instances(new BufferedReader(new FileReader(fnTrainData)));
    // preprocess instances
    String[] options = weka.core.Utils.splitOptions("-R 1");
    String filterName = "weka.filters.unsupervised.attribute.Remove";
    Filter filter = (Filter) Class.forName(filterName).newInstance();
    if (filter instanceof OptionHandler) {
        ((OptionHandler) filter).setOptions(options);
    }
    filter.setInputFormat(data);
    // make the instances
    Instances unlabeled = Filter.useFilter(data, filter);
    // train model
    this.trainModel(unlabeled);
}
 
開發者ID:NLPReViz,項目名稱:emr-nlp-server,代碼行數:17,代碼來源:CertSVMPredictor.java

示例3: removeAttribute

import weka.filters.Filter; //導入方法依賴的package包/類
public Instances removeAttribute(String attrIndex, Instances data) throws Exception {
    String[] options = weka.core.Utils.splitOptions("-R " + attrIndex);
    String filterName = "weka.filters.unsupervised.attribute.Remove";
    Filter filter = (Filter) Class.forName(filterName).newInstance();
    if (filter instanceof OptionHandler) {
        ((OptionHandler) filter).setOptions(options);
    }
    filter.setInputFormat(data);
    // make the instances
    return Filter.useFilter(data, filter);
}
 
開發者ID:NLPReViz,項目名稱:emr-nlp-server,代碼行數:12,代碼來源:SVMPredictor.java

示例4: buildAttributeFilterFor

import weka.filters.Filter; //導入方法依賴的package包/類
private static Filter buildAttributeFilterFor(AttributeFilter attributeFilter, Instances dataSet) throws Exception
{
    ASEvaluation evaluator = attributeFilter.getEvalClazz().newInstance();
    ((OptionHandler) evaluator).setOptions(Utils.splitOptions(attributeFilter.getEvalConfig()));

    ASSearch search = attributeFilter.getSearchClazz().newInstance();
    ((OptionHandler) search).setOptions(Utils.splitOptions(attributeFilter.getSearchConfig()));

    Filter filter = new AttributeSelection();
    filter.setInputFormat(dataSet);
    ((AttributeSelection) filter).setEvaluator(evaluator);
    ((AttributeSelection) filter).setSearch(search);

    return filter;
}
 
開發者ID:marcelovca90,項目名稱:anti-spam-weka-gui,代碼行數:16,代碼來源:FilterConfiguration.java

示例5: buildInstanceFilterFor

import weka.filters.Filter; //導入方法依賴的package包/類
private static Filter buildInstanceFilterFor(InstanceFilter instanceFilter, Instances dataSet) throws Exception
{
    Filter filter = instanceFilter.getClazz().newInstance();

    filter.setInputFormat(dataSet);
    filter.setOptions(Utils.splitOptions(instanceFilter.getConfig()));
    filter.setDebug(true);

    return filter;
}
 
開發者ID:marcelovca90,項目名稱:anti-spam-weka-gui,代碼行數:11,代碼來源:FilterConfiguration.java


注:本文中的weka.filters.Filter.setInputFormat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。