Package weka.filters.supervised.attribute

Examples of weka.filters.supervised.attribute.AttributeSelection


        ins=(Instances)Util.loadObject(f);     
      }
      else
      {
        ins=this.loadSamples(target);
        AttributeSelection filter= new AttributeSelection();
        filter.setEvaluator((ASEvaluation)Class.forName(Evaluator).newInstance());
        filter.setSearch((ASSearch)Class.forName(Search).newInstance());
        filter.setInputFormat(ins);
        ins=Filter.useFilter(ins, (Filter)filter);
        Util.writeObject(f, ins);
      }
      
    }
View Full Code Here


        hold.setClassIndex(hold.numAttributes()-1);
      
        // att sel ranking
        Random rndd = new Random(422);

        AttributeSelection attribSel = new AttributeSelection();

        att_ev_SingleBayesROCAttributeEval roc = new att_ev_SingleBayesROCAttributeEval();
        Ranker rnkr = new Ranker();

//        roc.buildEvaluator(learn);

        attribSel.setEvaluator(roc);
        attribSel.setSearch(rnkr);

        attribSel.setInputFormat(learn);
        Instances learnPostSel = attribSel.useFilter(learn, attribSel);
        Instances holdPostSel = attribSel.useFilter(hold, attribSel);

        wrep.BGS_univariate_ROC = new double[learn.numAttributes()-1];
        for (int univ_counter = 0 ; univ_counter<learnPostSel.numAttributes()-1; univ_counter++) {
            wrep.BGS_univariate_ROC[univ_counter] = roc.evaluateAttribute(univ_counter);
        }
View Full Code Here

    }

    public void addAttSelFilter(gui_WekaExperiment de) {
        try {

            AttributeSelection attSel = new AttributeSelection();
            CfsSubsetEval eval = new CfsSubsetEval();
            GreedyStepwise search = new GreedyStepwise();
            attSel.setEvaluator(eval);
            attSel.setSearch(search);
            //weka.filters.supervised.attribute.AttributeSelection -E "weka.attributeSelection.CfsSubsetEval " -S "weka.attributeSelection.BestFirst -D 1 -N 5"
            //String[] opt = {"-E", "\"weka.attributeSelection.CfsSubsetEval \"","-s","\"weka.attributeSelection.BestFirst -D 1 -N 5\"" };
            de.addFilter("weka.filters.supervised.attribute.AttributeSelection", attSel.getOptions());
        } catch (Exception ex) {
            System.out.println("AddAttSelFilterFail");
        }

    }
View Full Code Here

        hold.setClassIndex(hold.numAttributes() - 1);

        // att sel ranking
        Random rndd = new Random(422);

        AttributeSelection attribSel = new AttributeSelection();

        att_ev_TTestAttributeEval pval = new att_ev_TTestAttributeEval();
        Ranker rnkr = new Ranker();
//        rnkr.setThreshold(p_val_threshold);

//        roc.buildEvaluator(learn);

        attribSel.setEvaluator(pval);
        attribSel.setSearch(rnkr);


        attribSel.setInputFormat(learn);
        Instances learnPostSel = attribSel.useFilter(learn, attribSel);
        Instances holdPostSel = attribSel.useFilter(hold, attribSel);

        wrep.TTEST_univariate_p_value_raw = new double[learnPostSel.numAttributes() - 1];
        wrep.TTEST_univariate_p_value_log = new double[learnPostSel.numAttributes() - 1];
        wrep.TTEST_univariate_fold_change_log = new double[learnPostSel.numAttributes() - 1];
        wrep.TTEST_univariate_fold_change_raw = new double[learnPostSel.numAttributes() - 1];
View Full Code Here

        return filter;
    }
   
    protected Filter getFeatureSelectionFilter(ExampleSet examples) throws Exception {
       
        AttributeSelection filter = new AttributeSelection()// package weka.filters.supervised.attribute!
        //CfsSubsetEval eval = new CfsSubsetEval();
       
        //CorrelationAttributeEval eval = new CorrelationAttributeEval();
        //InfoGainAttributeEval eval = new InfoGainAttributeEval();
       
        ReliefFAttributeEval eval = new ReliefFAttributeEval();
       
        //GreedyStepwise search = new GreedyStepwise();
        //search.setNumToSelect(980);
        //search.setSearchBackwards(true);
       
        Ranker search = new Ranker();
        search.setNumToSelect(980);
       
        filter.setEvaluator(eval);
        filter.setSearch(search);
       
        filter.setInputFormat(examples.getInstances());
        Instances filtered = Filter.useFilter(examples.getInstances(), filter);
        examples.setInstances(filtered);
       
        return filter;
    }
View Full Code Here

TOP

Related Classes of weka.filters.supervised.attribute.AttributeSelection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.