All Downloads are FREE. Search and download functionalities are using the official Maven repository.

weka.attributeSelection.ClassifierAttributeEval Maven / Gradle / Ivy

Go to download

The Waikato Environment for Knowledge Analysis (WEKA), a machine learning workbench. This version represents the developer version, the "bleeding edge" of development, you could say. New functionality gets added to this version.

There is a newer version: 3.9.6
Show newest version
/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see .
 */

/*
 *    ClassifierAttributeEval.java
 *    Copyright (C) 2009 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.attributeSelection;

import java.util.ArrayList;
import java.util.BitSet;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Set;
import java.util.Vector;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import weka.classifiers.Classifier;
import weka.core.Capabilities;
import weka.core.Instances;
import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.RevisionUtils;
import weka.core.SelectedTag;
import weka.core.Utils;

/**
 
 * ClassifierAttributeEval :
*
* Evaluates the worth of an attribute by using a user-specified classifier.
*

* * Valid options are:

*

 -L
 *  Evaluate an attribute by measuring the impact of leaving it out
 *  from the full set instead of considering its worth in isolation
* *
 -B <base learner>
 *  class name of base learner to use for  accuracy estimation.
 *  Place any classifier options LAST on the command line
 *  following a "--". eg.:
 *   -B weka.classifiers.bayes.NaiveBayes ... -- -K
 *  (default: weka.classifiers.rules.ZeroR)
* *
 -F <num>
 *  number of cross validation folds to use for estimating accuracy.
 *  (default=5)
* *
 -R <seed>
 *  Seed for cross validation accuracy testimation.
 *  (default = 1)
* *
 -T <num>
 *  threshold by which to execute another cross validation
 *  (standard deviation---expressed as a percentage of the mean).
 *  (default: 0.01 (1%))
* *
 -E <acc | rmse | mae | f-meas | auc | auprc>
 *  Performance evaluation measure to use for selecting attributes.
 *  (Default = accuracy for discrete class and rmse for numeric class)
* *
 -IRclass <label | index>
 *  Optional class value (label or 1-based index) to use in conjunction with
 *  IR statistics (f-meas, auc or auprc). Omitting this option will use
 *  the class-weighted average.
* *
 
 * Options specific to scheme weka.classifiers.rules.ZeroR:
 * 
* *
 -output-debug-info
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console
* *
 -do-not-check-capabilities
 *  If set, classifier capabilities are not checked before classifier is built
 *  (use with caution).
* *
 -execution-slots <integer>
 *  Number of attributes to evaluate in parallel.
 *  Default = 1 (i.e. no parallelism)
* * * @author Mark Hall ([email protected]) * @author FracPete (fracpete at waikato dot ac dot nz) * @version $Revision: 14195 $ */ public class ClassifierAttributeEval extends ASEvaluation implements AttributeEvaluator, OptionHandler { /** for serialization. */ private static final long serialVersionUID = 2442390690522602284L; /** The training instances. */ protected Instances m_trainInstances; /** Holds the merit scores for each attribute */ protected double[] m_merit; /** The configured underlying Wrapper instance to use for evaluation */ protected WrapperSubsetEval m_wrapperTemplate = new WrapperSubsetEval(); /** Holds toString() info for the wrapper */ protected String m_wrapperSetup = ""; /** * Whether to leave each attribute out in turn and evaluate rather than just * evaluate on each attribute */ protected boolean m_leaveOneOut; /** Executor service for multi-threading */ protected transient ExecutorService m_pool; /** The number of attributes to evaluate in parallel */ protected int m_executionSlots = 1; /** * Constructor. */ public ClassifierAttributeEval() { resetOptions(); } /** * Returns a string describing this attribute evaluator. * * @return a description of the evaluator suitable for displaying in the * explorer/experimenter gui */ public String globalInfo() { return "ClassifierAttributeEval :\n\nEvaluates the worth of an attribute by " + "using a user-specified classifier.\n"; } /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy