A class that represents a random forest model for prediction tasks.
More...
#include <DecisionForest.h>
|
|
| Forest () |
| | Default constructor.
|
| |
| | Forest (std::string pathToFolder, bool isClassification) |
| | Constructor that initializes the forest from a folder of tree files.
|
| |
| void | constructForestFromFolder (std::string pathToFolder) |
| | Constructs the forest from a folder of tree files.
|
| |
| void | constructForestFromPaths (std::vector< std::string > &treesPathIn) |
| | Constructs the forest from a list of tree file paths.
|
| |
| void | predict (VectorPtr &input, std::vector< float > &resultVector, int numInputs, int numFeatures) |
| | Makes predictions using the forest.
|
| |
|
| static void | vectorizeForestFolder (std::string pathToFolder, std::vector< std::string > &pathVector) |
| | Scans a folder and collects paths to tree files.
|
| |
|
|
Node | forest [MAX_NUM_TREES][MAX_NUM_NODES_PER_TREE] |
| | Array of trees in the forest.
|
| |
|
int | numTrees |
| | Number of trees in the forest.
|
| |
|
bool | isClassification |
| | Flag indicating whether the forest is used for classification.
|
| |
A class that represents a random forest model for prediction tasks.
This class provides functionality to construct a random forest from a folder of tree files and make predictions using the forest.
◆ Forest()
| Forest::Forest |
( |
std::string | pathToFolder, |
|
|
bool | isClassification ) |
|
inline |
Constructor that initializes the forest from a folder of tree files.
- Parameters
-
| pathToFolder | The path to the folder containing tree files. |
| isClassification | Flag indicating whether the forest is used for classification. |
◆ constructForestFromFolder()
| void Forest::constructForestFromFolder |
( |
std::string | pathToFolder | ) |
|
|
inline |
Constructs the forest from a folder of tree files.
- Parameters
-
| pathToFolder | The path to the folder containing tree files. |
◆ constructForestFromPaths()
| void Forest::constructForestFromPaths |
( |
std::vector< std::string > & | treesPathIn | ) |
|
|
inline |
Constructs the forest from a list of tree file paths.
- Parameters
-
| treesPathIn | A vector of paths to tree files. |
◆ predict()
| void Forest::predict |
( |
VectorPtr & | input, |
|
|
std::vector< float > & | resultVector, |
|
|
int | numInputs, |
|
|
int | numFeatures ) |
|
inline |
Makes predictions using the forest.
- Parameters
-
| input | The input vector containing feature values. |
| resultVector | A vector to store the prediction results. |
| numInputs | The number of input samples. |
| numFeatures | The number of features in each input sample. |
◆ vectorizeForestFolder()
| static void Forest::vectorizeForestFolder |
( |
std::string | pathToFolder, |
|
|
std::vector< std::string > & | pathVector ) |
|
inlinestatic |
Scans a folder and collects paths to tree files.
- Parameters
-
| pathToFolder | The path to the folder containing tree files. |
| pathVector | A vector to store the paths of tree files. |
The documentation for this class was generated from the following file: