org.wdssii.decisiontree
Class GainRatioFitnessFunction

java.lang.Object
  extended by org.wdssii.decisiontree.GainRatioFitnessFunction
All Implemented Interfaces:
FitnessFunction

public class GainRatioFitnessFunction
extends Object
implements FitnessFunction

Picks a threshold to maximize the gain but uses gain-ratio as the fitness of this attribute

Author:
lakshman

Nested Class Summary
private static class GainRatioFitnessFunction.ValueAndCategory
           
 
Nested classes/interfaces inherited from interface org.wdssii.decisiontree.FitnessFunction
FitnessFunction.Split
 
Field Summary
private static double LOG2
           
 
Constructor Summary
GainRatioFitnessFunction()
           
 
Method Summary
private  float computeGain(GainRatioFitnessFunction.ValueAndCategory[] all, int numCategories, int split)
           
private  float computeGainRatio(GainRatioFitnessFunction.ValueAndCategory[] all, int numCategories, int split)
           
private  float computeInfo(GainRatioFitnessFunction.ValueAndCategory[] all, int numCategories, int start, int end)
           
 FitnessFunction.Split computeSplitAndGain(float[][] inputData, int[] targetClass, int numCategories, int[] toConsider, int attribute)
           
private static float log2(float p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG2

private static double LOG2
Constructor Detail

GainRatioFitnessFunction

public GainRatioFitnessFunction()
Method Detail

computeSplitAndGain

public FitnessFunction.Split computeSplitAndGain(float[][] inputData,
                                                 int[] targetClass,
                                                 int numCategories,
                                                 int[] toConsider,
                                                 int attribute)
Specified by:
computeSplitAndGain in interface FitnessFunction

computeGain

private float computeGain(GainRatioFitnessFunction.ValueAndCategory[] all,
                          int numCategories,
                          int split)

computeInfo

private float computeInfo(GainRatioFitnessFunction.ValueAndCategory[] all,
                          int numCategories,
                          int start,
                          int end)

log2

private static float log2(float p)

computeGainRatio

private float computeGainRatio(GainRatioFitnessFunction.ValueAndCategory[] all,
                               int numCategories,
                               int split)