weka.associations
Class HotSpot

java.lang.Object
  extended by weka.associations.HotSpot
All Implemented Interfaces:
java.io.Serializable, Associator, CapabilitiesHandler, Drawable, OptionHandler, RevisionHandler

public class HotSpot
extends java.lang.Object
implements Associator, OptionHandler, RevisionHandler, CapabilitiesHandler, Drawable, java.io.Serializable

HotSpot learns a set of rules (displayed in a tree-like structure) that maximize/minimize a target variable/value of interest. With a nominal target, one might want to look for segments of the data where there is a high probability of a minority value occuring (given the constraint of a minimum support). For a numeric target, one might be interested in finding segments where this is higher on average than in the whole data set. For example, in a health insurance scenario, find which health insurance groups are at the highest risk (have the highest claim ratio), or, which groups have the highest average insurance payout.

Valid options are:

 -c <num | first | last>
  The target index. (default = last)
 -V <num | first | last>
  The target value (nominal target only, default = first)
 -L
  Minimize rather than maximize.
 -S <num>
  Minimum value count (nominal target)/segment size (numeric target).
  Values between 0 and 1 are 
  interpreted as a percentage of 
  the total population; values > 1 are 
  interpreted as an absolute number of 
  instances (default = 0.3)
 -M <num>
  Maximum branching factor (default = 2)
 -I <num>
  Minimum improvement in target value in order 
  to add a new branch/test (default = 0.01 (1%))
 -D
  Output debugging info (duplicate rule lookup 
  hash table stats)

Version:
$Revision: 1.6 $
Author:
Mark Hall (mhall{[at]}pentaho{[dot]}org
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface weka.core.Drawable
BayesNet, NOT_DRAWABLE, TREE
 
Constructor Summary
HotSpot()
          Constructor
 
Method Summary
 void buildAssociations(Instances instances)
          Build the tree
 java.lang.String debugTipText()
          Returns the tip text for this property
 Capabilities getCapabilities()
          Returns default capabilities of HotSpot
 boolean getDebug()
          Get whether debugging info is output
 int getMaxBranchingFactor()
          Get the maximum branching factor
 boolean getMinimizeTarget()
          Get whether to minimize the target rather than maximize
 double getMinImprovement()
          Get the minimum improvement in the target necessary to add a test
 java.lang.String[] getOptions()
          Gets the current settings of HotSpot.
 java.lang.String getRevision()
          Returns the revision string.
 double getSupport()
          Get the minimum support
 java.lang.String getTarget()
          Get the target index as a string
 java.lang.String getTargetIndex()
          For a nominal target, get the index of the value of interest (1-based)
 java.lang.String globalInfo()
          Returns a string describing this classifier
 java.lang.String graph()
          Returns a string that describes a graph representing the object.
 int graphType()
          Returns the type of graph this scheme represents.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] args)
          Main method for testing this class.
 java.lang.String maxBranchingFactorTipText()
          Returns the tip text for this property
 java.lang.String minimizeTargetTipText()
          Returns the tip text for this property
 java.lang.String minImprovementTipText()
          Returns the tip text for this property
 void resetOptions()
          Reset options to their defaults
 void setDebug(boolean d)
          Set whether debugging info is output
 void setMaxBranchingFactor(int b)
          Set the maximum branching factor
 void setMinimizeTarget(boolean m)
          Set whether to minimize the target rather than maximize
 void setMinImprovement(double i)
          Set the minimum improvement in the target necessary to add a test
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setSupport(double s)
          Set the minimum support
 void setTarget(java.lang.String target)
          Set the target index
 void setTargetIndex(java.lang.String index)
          For a nominal target, set the index of the value of interest (1-based)
 java.lang.String supportTipText()
          Returns the tip text for this property
 java.lang.String targetIndexTipText()
          Returns the tip text for this property
 java.lang.String targetTipText()
          Returns the tip text for this property
 java.lang.String toString()
          Return the tree as a string
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HotSpot

public HotSpot()
Constructor

Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing this classifier

Returns:
a description of the classifier suitable for displaying in the explorer/experimenter gui

getCapabilities

public Capabilities getCapabilities()
Returns default capabilities of HotSpot

Specified by:
getCapabilities in interface Associator
Specified by:
getCapabilities in interface CapabilitiesHandler
Returns:
the capabilities of HotSpot
See Also:
Capabilities

buildAssociations

public void buildAssociations(Instances instances)
                       throws java.lang.Exception
Build the tree

Specified by:
buildAssociations in interface Associator
Parameters:
instances - the training instances
Throws:
java.lang.Exception - if something goes wrong

toString

public java.lang.String toString()
Return the tree as a string

Overrides:
toString in class java.lang.Object
Returns:
a String containing the tree

graph

public java.lang.String graph()
                       throws java.lang.Exception
Description copied from interface: Drawable
Returns a string that describes a graph representing the object. The string should be in XMLBIF ver. 0.3 format if the graph is a BayesNet, otherwise it should be in dotty format.

Specified by:
graph in interface Drawable
Returns:
the graph described by a string
Throws:
java.lang.Exception - if the graph can't be computed

targetTipText

public java.lang.String targetTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setTarget

public void setTarget(java.lang.String target)
Set the target index

Parameters:
target - the target index as a string (1-based)

getTarget

public java.lang.String getTarget()
Get the target index as a string

Returns:
the target index (1-based)

targetIndexTipText

public java.lang.String targetIndexTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setTargetIndex

public void setTargetIndex(java.lang.String index)
For a nominal target, set the index of the value of interest (1-based)

Parameters:
index - the index of the nominal value of interest

getTargetIndex

public java.lang.String getTargetIndex()
For a nominal target, get the index of the value of interest (1-based)

Returns:
the index of the nominal value of interest

minimizeTargetTipText

public java.lang.String minimizeTargetTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setMinimizeTarget

public void setMinimizeTarget(boolean m)
Set whether to minimize the target rather than maximize

Parameters:
m - true if target is to be minimized

getMinimizeTarget

public boolean getMinimizeTarget()
Get whether to minimize the target rather than maximize

Returns:
true if target is to be minimized

supportTipText

public java.lang.String supportTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getSupport

public double getSupport()
Get the minimum support

Returns:
the minimum support

setSupport

public void setSupport(double s)
Set the minimum support

Parameters:
s - the minimum support

maxBranchingFactorTipText

public java.lang.String maxBranchingFactorTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setMaxBranchingFactor

public void setMaxBranchingFactor(int b)
Set the maximum branching factor

Parameters:
b - the maximum branching factor

getMaxBranchingFactor

public int getMaxBranchingFactor()
Get the maximum branching factor

Returns:
the maximum branching factor

minImprovementTipText

public java.lang.String minImprovementTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setMinImprovement

public void setMinImprovement(double i)
Set the minimum improvement in the target necessary to add a test

Parameters:
i - the minimum improvement

getMinImprovement

public double getMinImprovement()
Get the minimum improvement in the target necessary to add a test

Returns:
the minimum improvement

debugTipText

public java.lang.String debugTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setDebug

public void setDebug(boolean d)
Set whether debugging info is output

Parameters:
d - true to output debugging info

getDebug

public boolean getDebug()
Get whether debugging info is output

Returns:
true if outputing debugging info

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
listOptions in interface OptionHandler
Returns:
an enumeration of all the available options.

resetOptions

public void resetOptions()
Reset options to their defaults


setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options.

Valid options are:

 -c <num | first | last>
  The target index. (default = last)
 -V <num | first | last>
  The target value (nominal target only, default = first)
 -L
  Minimize rather than maximize.
 -S <num>
  Minimum value count (nominal target)/segment size (numeric target).
  Values between 0 and 1 are 
  interpreted as a percentage of 
  the total population; values > 1 are 
  interpreted as an absolute number of 
  instances (default = 0.3)
 -M <num>
  Maximum branching factor (default = 2)
 -I <num>
  Minimum improvement in target value in order 
  to add a new branch/test (default = 0.01 (1%))
 -D
  Output debugging info (duplicate rule lookup 
  hash table stats)

Specified by:
setOptions in interface OptionHandler
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of HotSpot.

Specified by:
getOptions in interface OptionHandler
Returns:
an array of strings suitable for passing to setOptions

getRevision

public java.lang.String getRevision()
Returns the revision string.

Specified by:
getRevision in interface RevisionHandler
Returns:
the revision

graphType

public int graphType()
Returns the type of graph this scheme represents.

Specified by:
graphType in interface Drawable
Returns:
Drawable.TREE

main

public static void main(java.lang.String[] args)
Main method for testing this class.

Parameters:
args - the options