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

weka.attributeSelection.GainRatioAttributeEval 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 .
 */

/*
 *    GainRatioAttributeEval.java
 *    Copyright (C) 1999-2012 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.attributeSelection;

import java.util.Enumeration;
import java.util.Vector;

import weka.core.Capabilities;
import weka.core.Capabilities.Capability;
import weka.core.ContingencyTables;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.RevisionUtils;
import weka.core.Utils;
import weka.filters.Filter;
import weka.filters.supervised.attribute.Discretize;

/**
 *  GainRatioAttributeEval :
*
* Evaluates the worth of an attribute by measuring the gain ratio with respect * to the class.
*
* GainR(Class, Attribute) = (H(Class) - H(Class | Attribute)) / H(Attribute).
*

* * * Valid options are: *

* *

 * -M
 *  treat missing values as a seperate value.
 * 
* * * * @author Mark Hall ([email protected]) * @version $Revision: 11215 $ * @see Discretize */ public class GainRatioAttributeEval extends ASEvaluation implements AttributeEvaluator, OptionHandler { /** for serialization */ static final long serialVersionUID = -8504656625598579926L; /** The training instances */ private Instances m_trainInstances; /** The class index */ private int m_classIndex; /** The number of instances */ private int m_numInstances; /** The number of classes */ private int m_numClasses; /** Merge missing values */ private boolean m_missing_merge; /** * 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 "GainRatioAttributeEval :\n\nEvaluates the worth of an attribute " + "by measuring the gain ratio with respect to the class.\n\n" + "GainR(Class, Attribute) = (H(Class) - H(Class | Attribute)) / " + "H(Attribute).\n"; } /** * Constructor */ public GainRatioAttributeEval() { resetOptions(); } /** * 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