org.rosuda.klimt
Class SNode

java.lang.Object
  extended by org.rosuda.util.Node
      extended by org.rosuda.klimt.SNode
All Implemented Interfaces:
java.lang.Cloneable

public class SNode
extends Node
implements java.lang.Cloneable

Statistical Node class. It's used for storing statistical information in tree nodes.

Version:
$Id: SNode.java 945 2004-07-02 17:48:53Z urbaneks $

Field Summary
 int Cases
          # of cases
 java.lang.String Cond
          splitting condition as string
 int cx
          position of the node and its geometry (replaces former x,y,x2,y2)
 int cy
          position of the node and its geometry (replaces former x,y,x2,y2)
 int[] data
          list of indices of the data used in this node
 double devGain
          deviation gain by this split
 double F1
          deviation (or Gini-index) of this node
 int height
          position of the node and its geometry (replaces former x,y,x2,y2)
 int id
          id of the node
 java.awt.Rectangle labelR
          label rectangle
 java.lang.String Name
          name of tha class assigned to this node
 boolean overflowWarning
          overflow warning - if true then the node is bigger than its display representation
 double predValD
          predicted value (for regr. trees)
 double sampleDev
          deviance in this node based on the sample
 double sampleDevGain
          deviance gain based on the sample
 int sel
          selector (0=not sel, 1=selected node, 2=leaf of sel. category, 3=non-leaf of selected category
 int splitComp
          split compare type (-1/0/1)
 int splitIndex
          index of the split variable
 java.lang.String splitVal
          value of the split condition as string
 double splitValF
          value of the split condition as string
 SVar splitVar
          object of the splitting variable
 int tmp
          user definable temporary variable
 boolean underflowWarning
          underflow warning - if true then the node is displayed bigger than it should be
 java.util.Vector V
          values (percentage of each class)
 int width
          position of the node and its geometry (replaces former x,y,x2,y2)
 
Fields inherited from class org.rosuda.util.Node
ch, level, par
 
Constructor Summary
SNode()
          default constructor
SNode(Node t)
          constructs a new root node as the parent of a subtree
 
Method Summary
 void calculateSampleDeviances()
          calculates deviance and deviance gain based on the sample stored in data. note that this deviance may be different from the F1/devGain if the tree was based on another sample
 int getBinaryID()
          returns the ID of this node in a binary tree (root=1) or -1 if the tree is not a binary tree
 java.lang.String getFormula()
           
 RootInfo getRootInfo()
          returns root information associated with this tree
 SVarSet getSource()
          returns data source
 boolean isPruned()
          gets pruned flag
 void passDownData(SNode ct)
          pass data from node ct down to this node according to the conditions in this node
 void printTree(java.lang.String prefix)
          print the tree on System.out (mainly for debugging purposes)
 void setAllTmp(int v)
          sets temporary custom variable of the entire subtree to v
 void setFormula(java.lang.String form)
           
 void setPrune(boolean ps)
          set prune flag for this node and all children
 void setSource(SVarSet src)
          sets data source
 java.lang.String toString()
          returns basic string representation of this node (suitable for debugging only)
 
Methods inherited from class org.rosuda.util.Node
add, at, children, count, getAllNodes, getChildren, getHeight, getLevel, getNodesAtLevel, getNumNodes, getParent, getRoot, isLeaf, isRoot, prune, rebuildHeight, rebuildLevels, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

public int[] data
list of indices of the data used in this node


Cond

public java.lang.String Cond
splitting condition as string


Cases

public int Cases
# of cases


F1

public double F1
deviation (or Gini-index) of this node


devGain

public double devGain
deviation gain by this split


Name

public java.lang.String Name
name of tha class assigned to this node


predValD

public double predValD
predicted value (for regr. trees)


V

public java.util.Vector V
values (percentage of each class)


id

public int id
id of the node


sampleDev

public double sampleDev
deviance in this node based on the sample


sampleDevGain

public double sampleDevGain
deviance gain based on the sample


cx

public int cx
position of the node and its geometry (replaces former x,y,x2,y2)


cy

public int cy
position of the node and its geometry (replaces former x,y,x2,y2)


width

public int width
position of the node and its geometry (replaces former x,y,x2,y2)


height

public int height
position of the node and its geometry (replaces former x,y,x2,y2)


underflowWarning

public boolean underflowWarning
underflow warning - if true then the node is displayed bigger than it should be


overflowWarning

public boolean overflowWarning
overflow warning - if true then the node is bigger than its display representation


sel

public int sel
selector (0=not sel, 1=selected node, 2=leaf of sel. category, 3=non-leaf of selected category


splitIndex

public int splitIndex
index of the split variable


splitVar

public SVar splitVar
object of the splitting variable


splitComp

public int splitComp
split compare type (-1/0/1)


splitVal

public java.lang.String splitVal
value of the split condition as string


splitValF

public double splitValF
value of the split condition as string


labelR

public java.awt.Rectangle labelR
label rectangle


tmp

public int tmp
user definable temporary variable

Constructor Detail

SNode

public SNode()
default constructor


SNode

public SNode(Node t)
constructs a new root node as the parent of a subtree

Parameters:
t - subtree
Method Detail

setSource

public void setSource(SVarSet src)
sets data source

Parameters:
src - data source

getRootInfo

public RootInfo getRootInfo()
returns root information associated with this tree

Returns:
root information

setFormula

public void setFormula(java.lang.String form)

getFormula

public java.lang.String getFormula()

getSource

public SVarSet getSource()
returns data source

Returns:
data source

setPrune

public void setPrune(boolean ps)
set prune flag for this node and all children

Parameters:
ps - prune state to be set

isPruned

public boolean isPruned()
gets pruned flag

Returns:
pruned flag

printTree

public void printTree(java.lang.String prefix)
print the tree on System.out (mainly for debugging purposes)

Parameters:
prefix - text to be printed before each line of output

setAllTmp

public void setAllTmp(int v)
sets temporary custom variable of the entire subtree to v


calculateSampleDeviances

public void calculateSampleDeviances()
calculates deviance and deviance gain based on the sample stored in data. note that this deviance may be different from the F1/devGain if the tree was based on another sample


getBinaryID

public int getBinaryID()
returns the ID of this node in a binary tree (root=1) or -1 if the tree is not a binary tree


passDownData

public void passDownData(SNode ct)
pass data from node ct down to this node according to the conditions in this node


toString

public java.lang.String toString()
returns basic string representation of this node (suitable for debugging only)

Overrides:
toString in class java.lang.Object
Returns:
string representation of the contained data