|
Cpp ML Library
1.0.0
A library of Machine Learning Algorithmns seen from the Udemy course Machine Learning A to Z.
|
Implements a Random Forest Classifier. More...
#include <RandomForestClassifier.hpp>
Public Member Functions | |
| RandomForestClassifier (int n_estimators=10, int max_depth=5, int min_samples_split=2, int max_features=-1) | |
| Constructs a RandomForestClassifier. More... | |
| ~RandomForestClassifier ()=default | |
| Destructor for RandomForestClassifier. | |
| void | fit (const std::vector< std::vector< double >> &X, const std::vector< int > &y) |
| Fits the model to the training data. More... | |
| std::vector< int > | predict (const std::vector< std::vector< double >> &X) const |
| Predicts class labels for given input data. More... | |
Implements a Random Forest Classifier.
| RandomForestClassifier::RandomForestClassifier | ( | int | n_estimators = 10, |
| int | max_depth = 5, |
||
| int | min_samples_split = 2, |
||
| int | max_features = -1 |
||
| ) |
Constructs a RandomForestClassifier.
| n_estimators | The number of trees in the forest. |
| max_depth | The maximum depth of the tree. |
| min_samples_split | The minimum number of samples required to split an internal node. |
| max_features | The number of features to consider when looking for the best split. Defaults to sqrt(num_features). |
| void RandomForestClassifier::fit | ( | const std::vector< std::vector< double >> & | X, |
| const std::vector< int > & | y | ||
| ) |
Fits the model to the training data.
| X | A vector of feature vectors. |
| y | A vector of target class labels. |
| std::vector< int > RandomForestClassifier::predict | ( | const std::vector< std::vector< double >> & | X | ) | const |
Predicts class labels for given input data.
| X | A vector of feature vectors. |