Public Types | |
| typedef DecisionTree< FitnessFunction, NumericSplitType, CategoricalSplitType, DimensionSelectionType, ElemType > | DecisionTreeType |
| Allow access to the underlying decision tree type. More... | |
Public Member Functions | |
| RandomForest () | |
| Construct the random forest without any training or specifying the number of trees. More... | |
template < typename MatType > | |
| RandomForest (const MatType &dataset, const arma::Row< size_t > &labels, const size_t numClasses, const size_t numTrees=50, const size_t minimumLeafSize=20) | |
| Create a random forest, training on the given labeled training data with the given number of trees. More... | |
template < typename MatType > | |
| RandomForest (const MatType &dataset, const data::DatasetInfo &datasetInfo, const arma::Row< size_t > &labels, const size_t numClasses, const size_t numTrees=50, const size_t minimumLeafSize=20) | |
| Create a random forest, training on the given labeled training data with the given dataset info and the given number of trees. More... | |
template < typename MatType > | |
| RandomForest (const MatType &dataset, const arma::Row< size_t > &labels, const size_t numClasses, const arma::rowvec &weights, const size_t numTrees=50, const size_t minimumLeafSize=20) | |
| Create a random forest, training on the given weighted labeled training data with the given number of trees. More... | |
template < typename MatType > | |
| RandomForest (const MatType &dataset, const data::DatasetInfo &datasetInfo, const arma::Row< size_t > &labels, const size_t numClasses, const arma::rowvec &weights, const size_t numTrees=50, const size_t minimumLeafSize=20) | |
| Create a random forest, training on the given weighted labeled training data with the given dataset info and the given number of trees. More... | |
template < typename VecType > | |
| size_t | Classify (const VecType &point) const |
| Predict the class of the given point. More... | |
template < typename VecType > | |
| void | Classify (const VecType &point, size_t &prediction, arma::vec &probabilities) const |
| Predict the class of the given point and return the predicted class probabilities for each class. More... | |
template < typename MatType > | |
| void | Classify (const MatType &data, arma::Row< size_t > &predictions) const |
| Predict the classes of each point in the given dataset. More... | |
template < typename MatType > | |
| void | Classify (const MatType &data, arma::Row< size_t > &predictions, arma::mat &probabilities) const |
| Predict the classes of each point in the given dataset, also returning the predicted class probabilities for each point. More... | |
| size_t | NumTrees () const |
| Get the number of trees in the forest. More... | |
template < typename Archive > | |
| void | serialize (Archive &ar, const unsigned int) |
| Serialize the random forest. More... | |
template < typename MatType > | |
| void | Train (const MatType &data, const arma::Row< size_t > &labels, const size_t numClasses, const size_t numTrees=50, const size_t minimumLeafSize=20) |
| Train the random forest on the given labeled training data with the given number of trees. More... | |
template < typename MatType > | |
| void | Train (const MatType &data, const data::DatasetInfo &datasetInfo, const arma::Row< size_t > &labels, const size_t numClasses, const size_t numTrees=50, const size_t minimumLeafSize=20) |
| Train the random forest on the given labeled training data with the given dataset info and the given number of trees. More... | |
template < typename MatType > | |
| void | Train (const MatType &data, const arma::Row< size_t > &labels, const size_t numClasses, const arma::rowvec &weights, const size_t numTrees=50, const size_t minimumLeafSize=20) |
| Train the random forest on the given weighted labeled training data with the given number of trees. More... | |
template < typename MatType > | |
| void | Train (const MatType &data, const data::DatasetInfo &datasetInfo, const arma::Row< size_t > &labels, const size_t numClasses, const arma::rowvec &weights, const size_t numTrees=50, const size_t minimumLeafSize=20) |
| Train the random forest on the given weighted labeled training data with the given dataset info and the given number of trees. More... | |
| const DecisionTreeType & | Tree (const size_t i) const |
| Access a tree in the forest. More... | |
| DecisionTreeType & | Tree (const size_t i) |
| Modify a tree in the forest (be careful!). More... | |
Definition at line 27 of file random_forest.hpp.
| typedef DecisionTree<FitnessFunction, NumericSplitType, CategoricalSplitType, DimensionSelectionType, ElemType> DecisionTreeType |
Allow access to the underlying decision tree type.
Definition at line 32 of file random_forest.hpp.
|
inline |
Construct the random forest without any training or specifying the number of trees.
Predict() will throw an exception until Train() is called.
Definition at line 38 of file random_forest.hpp.
References RandomForest< FitnessFunction, DimensionSelectionType, NumericSplitType, CategoricalSplitType, ElemType >::Classify(), and RandomForest< FitnessFunction, DimensionSelectionType, NumericSplitType, CategoricalSplitType, ElemType >::Train().
| RandomForest | ( | const MatType & | dataset, |
| const arma::Row< size_t > & | labels, | ||
| const size_t | numClasses, | ||
| const size_t | numTrees = 50, |
||
| const size_t | minimumLeafSize = 20 |
||
| ) |
Create a random forest, training on the given labeled training data with the given number of trees.
The minimumLeafSize parameter is given to each individual decision tree during tree building.
| dataset | Dataset to train on. |
| labels | Labels for dataset. |
| numClasses | Number of classes in dataset. |
| numTrees | Number of trees in the forest. |
| minimumLeafSize | Minimum number of points in each tree's leaf nodes. |
| RandomForest | ( | const MatType & | dataset, |
| const data::DatasetInfo & | datasetInfo, | ||
| const arma::Row< size_t > & | labels, | ||
| const size_t | numClasses, | ||
| const size_t | numTrees = 50, |
||
| const size_t | minimumLeafSize = 20 |
||
| ) |
Create a random forest, training on the given labeled training data with the given dataset info and the given number of trees.
The minimumLeafSize parameter is given to each individual decision tree during tree building. This constructor can be used to train on categorical data.
| dataset | Dataset to train on. |
| datasetInfo | Dimension info for the dataset. |
| labels | Labels for dataset. |
| numClasses | Number of classes in dataset. |
| numTrees | Number of trees in the forest. |
| minimumLeafSize | Minimum number of points in each tree's leaf nodes. |
| RandomForest | ( | const MatType & | dataset, |
| const arma::Row< size_t > & | labels, | ||
| const size_t | numClasses, | ||
| const arma::rowvec & | weights, | ||
| const size_t | numTrees = 50, |
||
| const size_t | minimumLeafSize = 20 |
||
| ) |
Create a random forest, training on the given weighted labeled training data with the given number of trees.
The minimumLeafSize parameter is given to each individual decision tree during tree building.
| dataset | Dataset to train on. |
| labels | Labels for dataset. |
| numClasses | Number of classes in dataset. |
| weights | Weights (importances) of each point in the dataset. |
| numTrees | Number of trees in the forest. |
| minimumLeafSize | Minimum number of points in each tree's leaf nodes. |
| RandomForest | ( | const MatType & | dataset, |
| const data::DatasetInfo & | datasetInfo, | ||
| const arma::Row< size_t > & | labels, | ||
| const size_t | numClasses, | ||
| const arma::rowvec & | weights, | ||
| const size_t | numTrees = 50, |
||
| const size_t | minimumLeafSize = 20 |
||
| ) |
Create a random forest, training on the given weighted labeled training data with the given dataset info and the given number of trees.
The minimumLeafSize parameter is given to each individual decision tree during tree building. This can be used for categorical weighted training.
| dataset | Dataset to train on. |
| datasetInfo | Dimension info for the dataset. |
| labels | Labels for dataset. |
| numClasses | Number of classes in dataset. |
| weights | Weights (importances) of each point in the dataset. |
| numTrees | Number of trees in the forest. |
| minimumLeafSize | Minimum number of points in each tree's leaf nodes. |
| size_t Classify | ( | const VecType & | point | ) | const |
Predict the class of the given point.
If the random forest has not been trained, this will throw an exception.
| point | Point to be classified. |
Referenced by RandomForest< FitnessFunction, DimensionSelectionType, NumericSplitType, CategoricalSplitType, ElemType >::RandomForest().
| void Classify | ( | const VecType & | point, |
| size_t & | prediction, | ||
| arma::vec & | probabilities | ||
| ) | const |
Predict the class of the given point and return the predicted class probabilities for each class.
If the random forest has not been trained, this will throw an exception.
| point | Point to be classified. |
| prediction | size_t to store predicted class in. |
| probabilities | Output vector of class probabilities. |
| void Classify | ( | const MatType & | data, |
| arma::Row< size_t > & | predictions | ||
| ) | const |
Predict the classes of each point in the given dataset.
If the random forest has not been trained, this will throw an exception.
| data | Dataset to be classified. |
| predictions | Output predictions for each point in the dataset. |
| void Classify | ( | const MatType & | data, |
| arma::Row< size_t > & | predictions, | ||
| arma::mat & | probabilities | ||
| ) | const |
Predict the classes of each point in the given dataset, also returning the predicted class probabilities for each point.
If the random forest has not been trained, this will throw an exception.
| data | Dataset to be classified. |
| predictions | Output predictions for each point in the dataset. |
| probabilities | Output matrix of class probabilities for each point. |
|
inline |
Get the number of trees in the forest.
Definition at line 258 of file random_forest.hpp.
References RandomForest< FitnessFunction, DimensionSelectionType, NumericSplitType, CategoricalSplitType, ElemType >::serialize(), and RandomForest< FitnessFunction, DimensionSelectionType, NumericSplitType, CategoricalSplitType, ElemType >::Train().
| void serialize | ( | Archive & | ar, |
| const unsigned | int | ||
| ) |
Serialize the random forest.
Referenced by RandomForest< FitnessFunction, DimensionSelectionType, NumericSplitType, CategoricalSplitType, ElemType >::NumTrees().
| void Train | ( | const MatType & | data, |
| const arma::Row< size_t > & | labels, | ||
| const size_t | numClasses, | ||
| const size_t | numTrees = 50, |
||
| const size_t | minimumLeafSize = 20 |
||
| ) |
Train the random forest on the given labeled training data with the given number of trees.
The minimumLeafSize parameter is given to each individual decision tree during tree building.
| data | Dataset to train on. |
| labels | Labels for dataset. |
| numClasses | Number of classes in dataset. |
| numTrees | Number of trees in the forest. |
| minimumLeafSize | Minimum number of points in each tree's leaf nodes. |
Referenced by RandomForest< FitnessFunction, DimensionSelectionType, NumericSplitType, CategoricalSplitType, ElemType >::NumTrees(), and RandomForest< FitnessFunction, DimensionSelectionType, NumericSplitType, CategoricalSplitType, ElemType >::RandomForest().
| void Train | ( | const MatType & | data, |
| const data::DatasetInfo & | datasetInfo, | ||
| const arma::Row< size_t > & | labels, | ||
| const size_t | numClasses, | ||
| const size_t | numTrees = 50, |
||
| const size_t | minimumLeafSize = 20 |
||
| ) |
Train the random forest on the given labeled training data with the given dataset info and the given number of trees.
The minimumLeafSize parameter is given to each individual decision tree during tree building. This overload can be used to train on categorical data.
| data | Dataset to train on. |
| datasetInfo | Dimension info for the dataset. |
| labels | Labels for dataset. |
| numClasses | Number of classes in dataset. |
| numTrees | Number of trees in the forest. |
| minimumLeafSize | Minimum number of points in each tree's leaf nodes. |
| void Train | ( | const MatType & | data, |
| const arma::Row< size_t > & | labels, | ||
| const size_t | numClasses, | ||
| const arma::rowvec & | weights, | ||
| const size_t | numTrees = 50, |
||
| const size_t | minimumLeafSize = 20 |
||
| ) |
Train the random forest on the given weighted labeled training data with the given number of trees.
The minimumLeafSize parameter is given to each individual decision tree during tree building.
| data | Dataset to train on. |
| labels | Labels for dataset. |
| numClasses | Number of classes in dataset. |
| weights | Weights (importances) of each point in the dataset. |
| numTrees | Number of trees in the forest. |
| minimumLeafSize | Minimum number of points in each tree's leaf nodes. |
| void Train | ( | const MatType & | data, |
| const data::DatasetInfo & | datasetInfo, | ||
| const arma::Row< size_t > & | labels, | ||
| const size_t | numClasses, | ||
| const arma::rowvec & | weights, | ||
| const size_t | numTrees = 50, |
||
| const size_t | minimumLeafSize = 20 |
||
| ) |
Train the random forest on the given weighted labeled training data with the given dataset info and the given number of trees.
The minimumLeafSize parameter is given to each individual decision tree during tree building. This overload can be used for categorical weighted training.
| data | Dataset to train on. |
| datasetInfo | Dimension info for the dataset. |
| labels | Labels for dataset. |
| numClasses | Number of classes in dataset. |
| weights | Weights (importances) of each point in the dataset. |
| numTrees | Number of trees in the forest. |
| minimumLeafSize | Minimum number of points in each tree's leaf nodes. |
|
inline |
Access a tree in the forest.
Definition at line 253 of file random_forest.hpp.
|
inline |
Modify a tree in the forest (be careful!).
Definition at line 255 of file random_forest.hpp.