Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members

Tree::DecisionTree Class Reference

This class represent a node of a decision tree. More...

#include <decisiontree.hh>

List of all members.

Public Member Functions

 DecisionTree (const DecisionTree &tree)
 @ brief copy constructor

 DecisionTree (unsigned int classe)
 Constructor.

 DecisionTree::DecisionTree (const DecisionTree *father, unsigned int classe)
 Constructor.

void clear ()
 remove and delete all node and subnode

DecisionTreeadd_condition (Condition &cond)
 create a new sub-tree for this condition and return it

void cut ()
 remove all sub node (remove all content of _sons)

unsigned int get_best_class (std::vector< Data::Column * > &data, std::vector< unsigned int > &inds) const
 get best class (class that match the more inds possible in this tree)

unsigned int get_nb_condition () const
 return number of condition in this node

void set_class (unsigned int classe)
 set classification result for this node

bool match (std::vector< Data::Column * > &data, unsigned int ind) const
 return true when a individual match with fathers of current node

unsigned int get_class (std::vector< Data::Column * > &data, unsigned int ind) const
 get class result of an individual

unsigned int get_nb_nodes () const
 return the number of node in the tree

void remove_son (Condition &cond)
 remove a sub-tree by its condition

void add_node (DecisionTree &node, Condition &cond)
 add s sub-tree

void print (std::ostream &stream, unsigned int offset) const
 print decision tree

DecisionTreecopy () const
 return a copy of this tree (realoc all subtree and condition)

const std::vector< std::pair<
DecisionTree *, Condition * > > 
get_sons () const

Protected Member Functions

bool _submatch (const DecisionTree *son, std::vector< Data::Column * > &data, unsigned int ind) const
DecisionTree_copy (const DecisionTree *father) const
 copy this tree and change _father value with father

std::vector< std::pair< unsigned
int, unsigned int > > 
_get_best_class (std::vector< Data::Column * > &data, std::vector< unsigned int > &inds) const
 sub routine to find the class the the maximum number of individual (called by get_best_class)


Protected Attributes

const DecisionTree_father
unsigned int _class
const DecisionTree_myaddr
std::vector< std::pair< DecisionTree *,
Condition * > > 
_sons


Detailed Description

This class represent a node of a decision tree.

Author:
Julien LEMOINE <speedblue@debian.org>

Definition at line 42 of file decisiontree.hh.


Constructor & Destructor Documentation

Tree::DecisionTree::DecisionTree unsigned int  classe  ) 
 

Constructor.

Parameters:
classe represent the classification result, this value is return when there are no condition, or when there is no match

Definition at line 46 of file decisiontree.cc.


Member Function Documentation

Tree::DecisionTree::DecisionTree::DecisionTree const DecisionTree father,
unsigned int  classe
 

Constructor.

Parameters:
father represent the node one level up
classe represent the classification result, this value is return when there are no condition, or when there is no match

unsigned int Tree::DecisionTree::get_class std::vector< Data::Column * > &  data,
unsigned int  ind
const
 

get class result of an individual

Parameters:
data represent all the data
ind represent the individual to test

Definition at line 202 of file decisiontree.cc.

Referenced by Algo::TreeBasedAlgo::_compute_error().

bool Tree::DecisionTree::match std::vector< Data::Column * > &  data,
unsigned int  ind
const
 

return true when a individual match with fathers of current node

Parameters:
data represent all the data
ind represent the individual to test

Definition at line 193 of file decisiontree.cc.

References _submatch().

Referenced by Algo::C45::_c45_construct_tree(), Algo::TreeBasedAlgo::_compute_error(), Algo::TreeBasedAlgo::_compute_n(), Algo::TreeBasedAlgo::_entropie(), _get_best_class(), Algo::ID3::_get_classe(), Algo::C45::_get_classe(), Algo::TreeBasedAlgo::_get_classes(), Algo::TreeBasedAlgo::_gini(), Algo::ID3::_id3_construct_tree(), Algo::TreeBasedAlgo::_sub_construct_tree(), Data::ColumnTyped< Type >::is_finish(), and Data::ColumnTyped< Type >::is_finished().


The documentation for this class was generated from the following files:
Generated on Tue Jul 29 15:39:09 2003 for libdatamining by doxygen 1.3.2