org.rosuda.klimt
Class Klimt

java.lang.Object
  extended by org.rosuda.klimt.Klimt

public class Klimt
extends java.lang.Object

Main Klimt Trees class. Besides the main method it also contains methods for data root and tree handling.


Field Summary
static java.lang.String lastTreeFileName
          file name of the most recently loaded tree.
static java.lang.String lastUsedDir
           
static java.lang.String Release
           
static java.lang.String Version
           
 
Constructor Summary
Klimt()
           
 
Method Summary
static void addData(DataRoot dr)
          add a new data root
static DataRoot addData(SVarSet vs)
          create a new data root for the data set and return the corresponding root. if a root containing this dataset is already present, if will be returned without creating a new root. therefore it is safe to use this method for existing data sets.
static java.util.Vector getData()
          return vector of all data roots
static SVar getPredictionVar(SNode t, SVar cv, SVarSet resolver)
           
static SVar getPredictionVar(SNode t, SVar cv, SVar rccv, SVar nids)
          construct prediction variable, RCC/residuals variabe and node-index variable
static DataRoot getRootForData(SVarSet vs)
          return corresponding DataRoot object to the specified dataset
static DataRoot getRootForTreeRegistry(TreeRegistry tr)
          return corresponding DataRoot object to the specified dataset
static SNode loadTreeFile(java.io.File f, DataRoot dr, boolean createFrames)
           
static void main(java.lang.String[] argv)
          Main InTrees method, entry for KLIMT as stand-alone application.
static SNode makePrunedCopy(SNode t)
          creates a pruned copy of a tree
static SNode makePrunedCopy(SNode t, boolean deepCopy, SNode cutpoint, boolean imTheRoot, java.util.Vector cps, java.lang.String newName)
           
static SVar manageMisclassVar(SNode t, SVar smcv)
          manages internal misclassification variable - that is creates new one if none exists or updates existing one
static boolean manageResidualStats(SNode t, int regCount, SVar rs1, SVar rs2)
           
static TreeCanvas newTreeDisplay(SNode t, TFrame tf)
          creates a new tree display with default geometry (0,0,800,500)
static TreeCanvas newTreeDisplay(SNode t, TFrame tf, int x, int y, int w, int h)
          creates a new tree display
static VarFrame newVarDisplay(DataRoot dr)
          creates a new variables display with default geometry (0,0,140,200)
static VarFrame newVarDisplay(DataRoot dr, int x, int y, int w, int h)
          creates a new variables display
static SNode openTreeFile(java.awt.Frame f, java.lang.String fn, DataRoot dr)
           
static SNode openTreeFile(java.awt.Frame f, java.lang.String fn, DataRoot dr, boolean readOnlyDataset, boolean createFrames)
          loads a dataset and a tree from a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Version

public static java.lang.String Version

Release

public static java.lang.String Release

lastTreeFileName

public static java.lang.String lastTreeFileName
file name of the most recently loaded tree. Because of more recent support of multiple trees the use of the variable is deprecated for external packages.


lastUsedDir

public static java.lang.String lastUsedDir
Constructor Detail

Klimt

public Klimt()
Method Detail

getData

public static java.util.Vector getData()
return vector of all data roots


getRootForData

public static DataRoot getRootForData(SVarSet vs)
return corresponding DataRoot object to the specified dataset

Parameters:
vs - dataset
Returns:
root object or null if none was found

getRootForTreeRegistry

public static DataRoot getRootForTreeRegistry(TreeRegistry tr)
return corresponding DataRoot object to the specified dataset

Parameters:
vs - dataset
Returns:
root object or null if none was found

addData

public static void addData(DataRoot dr)
add a new data root

Parameters:
dr - data root to add

addData

public static DataRoot addData(SVarSet vs)
create a new data root for the data set and return the corresponding root. if a root containing this dataset is already present, if will be returned without creating a new root. therefore it is safe to use this method for existing data sets.

Parameters:
vs - data set to add
Returns:
data root corresponding to the data set (created if necessary)

newTreeDisplay

public static TreeCanvas newTreeDisplay(SNode t,
                                        TFrame tf,
                                        int x,
                                        int y,
                                        int w,
                                        int h)
creates a new tree display

Parameters:
t - root node
tf - frame of the tree
x,y,w,h - initial geometry of the canvas
Returns:
the newly created canvas

newTreeDisplay

public static TreeCanvas newTreeDisplay(SNode t,
                                        TFrame tf)
creates a new tree display with default geometry (0,0,800,500)

Parameters:
t - root node
tf - frame of the tree
Returns:
the newly created canvas

newVarDisplay

public static VarFrame newVarDisplay(DataRoot dr,
                                     int x,
                                     int y,
                                     int w,
                                     int h)
creates a new variables display

Parameters:
vs - the underlying dataset
x,y,w,h - initial geomery. Note: VarFrame itself modifies the height if necessary
Returns:
the newly created variables canvas

newVarDisplay

public static VarFrame newVarDisplay(DataRoot dr)
creates a new variables display with default geometry (0,0,140,200)

Parameters:
vs - the underlying dataset
Returns:
the newly created variables canvas

makePrunedCopy

public static SNode makePrunedCopy(SNode t)
creates a pruned copy of a tree

Parameters:
t - root of the source tree
Returns:
copy of the tree without pruned nodes

makePrunedCopy

public static SNode makePrunedCopy(SNode t,
                                   boolean deepCopy,
                                   SNode cutpoint,
                                   boolean imTheRoot,
                                   java.util.Vector cps,
                                   java.lang.String newName)

openTreeFile

public static SNode openTreeFile(java.awt.Frame f,
                                 java.lang.String fn,
                                 DataRoot dr)

openTreeFile

public static SNode openTreeFile(java.awt.Frame f,
                                 java.lang.String fn,
                                 DataRoot dr,
                                 boolean readOnlyDataset,
                                 boolean createFrames)
loads a dataset and a tree from a file.

Parameters:
f - frame to be used for FileDialog if necessary
fn - filename of the source. If null FileDialog is used to let the user select the file
tvs - SVarSet object to be used for storage of the dataset.
readOnlyDataset - if set to true then tvs is not modified except for classifier
Returns:
root node of the tree or null if no tree was present. This methods returns null even if the dataset was loaded correcly and no tree was present. Total failure to process the file can be determined only by using clean dataset and check for size of the dataset after the call.

loadTreeFile

public static SNode loadTreeFile(java.io.File f,
                                 DataRoot dr,
                                 boolean createFrames)

main

public static void main(java.lang.String[] argv)
Main InTrees method, entry for KLIMT as stand-alone application.

Parameters:
argv - Run-time parameters. The syntax is as follows:
 [--debug] source [source2 [source3 [...]]]

 source must contain a dataset and may contain a tree
 source2... must contain a tree only
 the --debug parameter switches debugging output on

manageMisclassVar

public static SVar manageMisclassVar(SNode t,
                                     SVar smcv)
manages internal misclassification variable - that is creates new one if none exists or updates existing one


manageResidualStats

public static boolean manageResidualStats(SNode t,
                                          int regCount,
                                          SVar rs1,
                                          SVar rs2)

getPredictionVar

public static SVar getPredictionVar(SNode t,
                                    SVar cv,
                                    SVarSet resolver)

getPredictionVar

public static SVar getPredictionVar(SNode t,
                                    SVar cv,
                                    SVar rccv,
                                    SVar nids)
construct prediction variable, RCC/residuals variabe and node-index variable