StochTree 0.0.1
Loading...
Searching...
No Matches
Classes | Functions
Tree API

Classes / functions for creating and modifying decision trees. More...

Classes

class  StochTree::Tree
 Decision tree data structure. More...
 
class  StochTree::TreeSplit
 Representation of arbitrary tree split rules, including numeric split rules (X[,i] <= c) and categorical split rules (X[,i] in {2,4,6,7}) More...
 

Functions

bool StochTree::operator== (const Tree &lhs, const Tree &rhs)
 Comparison operator for trees.
 
bool StochTree::SplitTrueNumeric (double fvalue, double threshold)
 Determine whether an observation produces a "true" value in a numeric split node.
 
bool StochTree::SplitTrueCategorical (double fvalue, std::vector< std::uint32_t > const &category_list)
 Determine whether an observation produces a "true" value in a categorical split node.
 
int StochTree::NextNodeNumeric (double fvalue, double threshold, int left_child, int right_child)
 Return left or right node id based on a numeric split.
 
int StochTree::NextNodeCategorical (double fvalue, std::vector< std::uint32_t > const &category_list, int left_child, int right_child)
 Return left or right node id based on a categorical split.
 
int StochTree::EvaluateTree (Tree const &tree, Eigen::MatrixXd &data, int row)
 
int StochTree::EvaluateTree (Tree const &tree, Eigen::Map< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > > &data, int row)
 
bool StochTree::RowSplitLeft (Eigen::MatrixXd &covariates, int row, int split_index, double split_value)
 Determine whether a given observation is "true" at a split proposed by split_index and split_value.
 
bool StochTree::RowSplitLeft (Eigen::MatrixXd &covariates, int row, int split_index, std::vector< std::uint32_t > const &category_list)
 Determine whether a given observation is "true" at a split proposed by split_index and split_value.
 

Detailed Description

Classes / functions for creating and modifying decision trees.

Design

Function Documentation

◆ SplitTrueNumeric()

bool StochTree::SplitTrueNumeric ( double  fvalue,
double  threshold 
)
inline

Determine whether an observation produces a "true" value in a numeric split node.

Parameters
fvalueValue of the split feature for the observation
thresholdValue of the numeric split threshold at the node
left_childNode id of the left child
right_childNode id of the right child

◆ SplitTrueCategorical()

bool StochTree::SplitTrueCategorical ( double  fvalue,
std::vector< std::uint32_t > const &  category_list 
)
inline

Determine whether an observation produces a "true" value in a categorical split node.

Parameters
fvalueValue of the split feature for the observation
category_listCategory indices that route an observation to the left child
left_childNode id of the left child
right_childNode id of the right child

◆ NextNodeNumeric()

int StochTree::NextNodeNumeric ( double  fvalue,
double  threshold,
int  left_child,
int  right_child 
)
inline

Return left or right node id based on a numeric split.

Parameters
fvalueValue of the split feature for the observation
thresholdValue of the numeric split threshold at the node
left_childNode id of the left child
right_childNode id of the right child

◆ NextNodeCategorical()

int StochTree::NextNodeCategorical ( double  fvalue,
std::vector< std::uint32_t > const &  category_list,
int  left_child,
int  right_child 
)
inline

Return left or right node id based on a categorical split.

Parameters
fvalueValue of the split feature for the observation
category_listCategory indices that route an observation to the left child
left_childNode id of the left child
right_childNode id of the right child

◆ EvaluateTree() [1/2]

int StochTree::EvaluateTree ( Tree const &  tree,
Eigen::MatrixXd &  data,
int  row 
)
inline

Determine the node at which a tree places a given observation

Parameters
treeTree object used for prediction
dataDataset used for prediction
rowRow indexing the prediction observation

◆ EvaluateTree() [2/2]

int StochTree::EvaluateTree ( Tree const &  tree,
Eigen::Map< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > > &  data,
int  row 
)
inline

Determine the node at which a tree places a given observation

Parameters
treeTree object used for prediction
dataDataset used for prediction
rowRow indexing the prediction observation

◆ RowSplitLeft() [1/2]

bool StochTree::RowSplitLeft ( Eigen::MatrixXd &  covariates,
int  row,
int  split_index,
double  split_value 
)
inline

Determine whether a given observation is "true" at a split proposed by split_index and split_value.

Parameters
covariatesDataset used for prediction
rowRow indexing the prediction observation
split_indexColumn of new split
split_valueValue defining the split

◆ RowSplitLeft() [2/2]

bool StochTree::RowSplitLeft ( Eigen::MatrixXd &  covariates,
int  row,
int  split_index,
std::vector< std::uint32_t > const &  category_list 
)
inline

Determine whether a given observation is "true" at a split proposed by split_index and split_value.

Parameters
covariatesDataset used for prediction
rowRow indexing the prediction observation
split_indexColumn of new split
category_listCategories defining the split