Cpp ML Library  1.0.0
A library of Machine Learning Algorithmns seen from the Udemy course Machine Learning A to Z.
Classes | Public Member Functions | List of all members
DecisionTreeRegressor Class Reference

Implements a Decision Tree Regressor. More...

#include <DecisionTreeRegressor.hpp>

Public Member Functions

 DecisionTreeRegressor (int max_depth=5, int min_samples_split=2)
 Constructs a DecisionTreeRegressor. More...
 
 ~DecisionTreeRegressor ()
 Destructor for DecisionTreeRegressor.
 
void fit (const std::vector< std::vector< double >> &X, const std::vector< double > &y)
 Fits the model to the training data. More...
 
std::vector< double > predict (const std::vector< std::vector< double >> &X) const
 Predicts target values for given input data. More...
 

Detailed Description

Implements a Decision Tree Regressor.

Constructor & Destructor Documentation

◆ DecisionTreeRegressor()

DecisionTreeRegressor::DecisionTreeRegressor ( int  max_depth = 5,
int  min_samples_split = 2 
)

Constructs a DecisionTreeRegressor.

Parameters
max_depthThe maximum depth of the tree.
min_samples_splitThe minimum number of samples required to split an internal node.

Member Function Documentation

◆ fit()

void DecisionTreeRegressor::fit ( const std::vector< std::vector< double >> &  X,
const std::vector< double > &  y 
)

Fits the model to the training data.

Parameters
XA vector of feature vectors.
yA vector of target values.

◆ predict()

std::vector< double > DecisionTreeRegressor::predict ( const std::vector< std::vector< double >> &  X) const

Predicts target values for given input data.

Parameters
XA vector of feature vectors.
Returns
A vector of predicted target values.

The documentation for this class was generated from the following file: