CNum 0.2.1
CPU-optimized ML library for C++
Loading...
Searching...
No Matches
CNum::Utils::ModelUtils Namespace Reference

Utilities used in CNum ML models. More...

Functions

::std::unique_ptr< CNum::DataStructs::Matrix< double >[] > train_test_split (const CNum::DataStructs::Matrix< double > &X, const CNum::DataStructs::Matrix< double > &y, double test_percentage=0.2, bool shuffle=true, uint64_t logical_id=0)
 Split a data set into train and split subsets.
void print_tree (CNum::Model::Tree::TreeBoosterNode *node, int spaces=10)
 Print a tree (left to right instead of top down).

Detailed Description

Utilities used in CNum ML models.

@namesapce CNum::Utils::ModelUtils

Function Documentation

◆ print_tree()

void CNum::Utils::ModelUtils::print_tree ( CNum::Model::Tree::TreeBoosterNode * node,
int spaces = 10 )

Print a tree (left to right instead of top down).

Parameters
nodeA node in a TreeBooster
spacesthe amount of spaces to print before the node's value

◆ train_test_split()

::std::unique_ptr< CNum::DataStructs::Matrix< double >[] > CNum::Utils::ModelUtils::train_test_split ( const CNum::DataStructs::Matrix< double > & X,
const CNum::DataStructs::Matrix< double > & y,
double test_percentage = 0.2,
bool shuffle = true,
uint64_t logical_id = 0 )

Split a data set into train and split subsets.

Parameters
XThe dataset
yThe labels for the dataset
test_percentageThe percentage of the dataset to use for the test subset
shuffleWhether or not to shuffle the dataset
logical_idThe logical id of the RNG stream