Main Page | Class List | File List | Class Members

Tree Class Reference

A single decision tree. More...

#include <tree.h>

List of all members.

Public Member Functions

 Tree (istream &in)
 Construct a new tree by loading it from a file.

 Tree (const InstanceSet &set, weight_list *weights, int K, uchar max_depth=16, int min_size=1, float min_gain=0, unsigned int seed=0)
 Construct a new tree by training.

int predict (const Instance &c) const
 predict a new instance

int predict (const InstanceSet &set, int instance_no) const
 predict an instance from a set

float training_accuracy () const
 Return the accuracy for the training set.

float testing_accuracy (const InstanceSet &testset) const
float oob_accuracy () const
void oob_cases (weight_list *counts, weight_list *correct) const
void variable_importance (map< int, float > *scores, unsigned int *seed) const
void print () const
void grow ()
void write (ostream &o) const
void read (istream &i)


Detailed Description

Strategy:

Trees can only be created in two ways:

  1. load from a saved model
  2. grown from a certain bagging of a dataset


Constructor & Destructor Documentation

Tree const InstanceSet set,
weight_list *  weights,
int  K,
uchar  max_depth = 16,
int  min_size = 1,
float  min_gain = 0,
unsigned int  seed = 0
 

Constructor

Parameters:
set training set
weights weights --- presumably from bagging process
K number of vars to try per split
max_depth (to be deprecated)
min_size minimum number of instances in a node
min_gain minimum information gain for making a split
seed random seed


Member Function Documentation

void grow  ) 
 

Do the work of growing the tree

  • Copy the data into special matrix
  • Build the tree
  • Delete special matrix

void read istream &  in  ) 
 

Read the tree from disk

void write ostream &  o  )  const
 

Save a tree to disk Important things to record:

  • Nodes (all active nodes need to be written)
  • WeightList ? - this seems irrelevant without the instance set
  • Statistics?


The documentation for this class was generated from the following files:
Generated on Mon Jan 8 23:19:06 2007 for librf by doxygen 1.3.7