|
mlpack
master
|
This class is a serializable Hoeffding tree model that can hold four different types of Hoeffding trees. More...
Public Types | |
| typedef HoeffdingTree< GiniImpurity, BinaryDoubleNumericSplit, HoeffdingCategoricalSplit > | GiniBinaryTreeType |
| Convenience typedef for GINI_BINARY tree type. More... | |
| typedef HoeffdingTree< GiniImpurity, HoeffdingDoubleNumericSplit, HoeffdingCategoricalSplit > | GiniHoeffdingTreeType |
| Convenience typedef for GINI_HOEFFDING tree type. More... | |
| typedef HoeffdingTree< InformationGain, BinaryDoubleNumericSplit, HoeffdingCategoricalSplit > | InfoBinaryTreeType |
| Convenience typedef for INFO_BINARY tree type. More... | |
| typedef HoeffdingTree< InformationGain, HoeffdingDoubleNumericSplit, HoeffdingCategoricalSplit > | InfoHoeffdingTreeType |
| Convenience typedef for INFO_HOEFFDING tree type. More... | |
| enum | TreeType { GINI_HOEFFDING, GINI_BINARY, INFO_HOEFFDING, INFO_BINARY } |
| This enumerates the four types of trees we can hold. More... | |
Public Member Functions | |
| HoeffdingTreeModel (const TreeType &type=GINI_HOEFFDING) | |
| Construct the Hoeffding tree model, but don't initialize any tree. More... | |
| HoeffdingTreeModel (const HoeffdingTreeModel &other) | |
| Copy the Hoeffding tree model from the given other model. More... | |
| HoeffdingTreeModel (HoeffdingTreeModel &&other) | |
| Move the Hoeffding tree model from the given other model. More... | |
| ~HoeffdingTreeModel () | |
| Clean up the given model. More... | |
| void | BuildModel (const arma::mat &dataset, const data::DatasetInfo &datasetInfo, const arma::Row< size_t > &labels, const size_t numClasses, const bool batchTraining, const double successProbability, const size_t maxSamples, const size_t checkInterval, const size_t minSamples, const size_t bins, const size_t observationsBeforeBinning) |
| Train the model on the given dataset with the given labels. More... | |
| void | Classify (const arma::mat &dataset, arma::Row< size_t > &predictions) const |
| Using the model, classify the given test points. More... | |
| void | Classify (const arma::mat &dataset, arma::Row< size_t > &predictions, arma::rowvec &probabilities) const |
| Using the model, classify the given test points, returning class probabilities. More... | |
| size_t | NumNodes () const |
| Get the number of nodes in the tree. More... | |
| HoeffdingTreeModel & | operator= (const HoeffdingTreeModel &other) |
| Copy the Hoeffding tree model from the given other model. More... | |
| HoeffdingTreeModel & | operator= (HoeffdingTreeModel &&other) |
| Move the Hoeffding tree model from the given other model. More... | |
| template<typename Archive > | |
| void | Serialize (Archive &ar, const unsigned int) |
| Serialize the model. More... | |
| void | Train (const arma::mat &dataset, const arma::Row< size_t > &labels, const bool batchTraining) |
| Train in streaming mode on the given dataset. More... | |
Private Attributes | |
| GiniBinaryTreeType * | giniBinaryTree |
| This is used if we are using the Gini impurity and the binary numeric split. More... | |
| GiniHoeffdingTreeType * | giniHoeffdingTree |
| This is used if we are using the Gini impurity and the Hoeffding numeric split. More... | |
| InfoBinaryTreeType * | infoBinaryTree |
| This is used if we are using the information gain and the binary numeric split. More... | |
| InfoHoeffdingTreeType * | infoHoeffdingTree |
| This is used if we are using the information gain and the Hoeffding numeric split. More... | |
| TreeType | type |
| The type of tree we are using. More... | |
This class is a serializable Hoeffding tree model that can hold four different types of Hoeffding trees.
It is meant to be used by the command-line program for Hoeffding trees.
Definition at line 22 of file hoeffding_tree_model.hpp.
| typedef HoeffdingTree<GiniImpurity, BinaryDoubleNumericSplit, HoeffdingCategoricalSplit> mlpack::tree::HoeffdingTreeModel::GiniBinaryTreeType |
Convenience typedef for GINI_BINARY tree type.
Definition at line 39 of file hoeffding_tree_model.hpp.
| typedef HoeffdingTree<GiniImpurity, HoeffdingDoubleNumericSplit, HoeffdingCategoricalSplit> mlpack::tree::HoeffdingTreeModel::GiniHoeffdingTreeType |
Convenience typedef for GINI_HOEFFDING tree type.
Definition at line 36 of file hoeffding_tree_model.hpp.
| typedef HoeffdingTree<InformationGain, BinaryDoubleNumericSplit, HoeffdingCategoricalSplit> mlpack::tree::HoeffdingTreeModel::InfoBinaryTreeType |
Convenience typedef for INFO_BINARY tree type.
Definition at line 45 of file hoeffding_tree_model.hpp.
| typedef HoeffdingTree<InformationGain, HoeffdingDoubleNumericSplit, HoeffdingCategoricalSplit> mlpack::tree::HoeffdingTreeModel::InfoHoeffdingTreeType |
Convenience typedef for INFO_HOEFFDING tree type.
Definition at line 42 of file hoeffding_tree_model.hpp.
This enumerates the four types of trees we can hold.
| Enumerator | |
|---|---|
| GINI_HOEFFDING | |
| GINI_BINARY | |
| INFO_HOEFFDING | |
| INFO_BINARY | |
Definition at line 26 of file hoeffding_tree_model.hpp.
| mlpack::tree::HoeffdingTreeModel::HoeffdingTreeModel | ( | const TreeType & | type = GINI_HOEFFDING | ) |
Construct the Hoeffding tree model, but don't initialize any tree.
Be sure to call Train() before doing anything with the model!
| type | Type of tree that will be used. |
| mlpack::tree::HoeffdingTreeModel::HoeffdingTreeModel | ( | const HoeffdingTreeModel & | other | ) |
Copy the Hoeffding tree model from the given other model.
| other | Hoeffding tree model to copy. |
| mlpack::tree::HoeffdingTreeModel::HoeffdingTreeModel | ( | HoeffdingTreeModel && | other | ) |
Move the Hoeffding tree model from the given other model.
| other | Hoeffding tree model to move. |
| mlpack::tree::HoeffdingTreeModel::~HoeffdingTreeModel | ( | ) |
Clean up the given model.
| void mlpack::tree::HoeffdingTreeModel::BuildModel | ( | const arma::mat & | dataset, |
| const data::DatasetInfo & | datasetInfo, | ||
| const arma::Row< size_t > & | labels, | ||
| const size_t | numClasses, | ||
| const bool | batchTraining, | ||
| const double | successProbability, | ||
| const size_t | maxSamples, | ||
| const size_t | checkInterval, | ||
| const size_t | minSamples, | ||
| const size_t | bins, | ||
| const size_t | observationsBeforeBinning | ||
| ) |
Train the model on the given dataset with the given labels.
This method just passes to the appropriate HoeffdingTree<...> constructor, and will train with one pass over the dataset.
| dataset | Dataset to train on. |
| datasetInfo | Information about dimensions of dataset. |
| labels | Labels for training set. |
| numClasses | Number of classes in dataset. |
| batchTraining | Whether or not to train in batch. |
| successProbability | Probability of success required in Hoeffding bound before a split can happen. |
| maxSamples | Maximum number of samples before a split is forced. |
| checkInterval | Number of samples required before each split check. |
| minSamples | If the node has seen this many points or fewer, no split will be allowed. |
| bins | Number of bins, for Hoeffding numeric split. |
| observationsBeforeBinning | Number of observations before binning, for Hoeffding numeric split. |
| void mlpack::tree::HoeffdingTreeModel::Classify | ( | const arma::mat & | dataset, |
| arma::Row< size_t > & | predictions | ||
| ) | const |
Using the model, classify the given test points.
Be sure that BuildModel() has been called first!
| dataset | Dataset to classify. |
| predictions | Vector to store predictions for test points in. |
| void mlpack::tree::HoeffdingTreeModel::Classify | ( | const arma::mat & | dataset, |
| arma::Row< size_t > & | predictions, | ||
| arma::rowvec & | probabilities | ||
| ) | const |
Using the model, classify the given test points, returning class probabilities.
| dataset | Dataset to classify. |
| predictions | Vector to store predictions for test points in. |
| probabilities | Vector to store probabilities for test points in. |
| size_t mlpack::tree::HoeffdingTreeModel::NumNodes | ( | ) | const |
Get the number of nodes in the tree.
| HoeffdingTreeModel& mlpack::tree::HoeffdingTreeModel::operator= | ( | const HoeffdingTreeModel & | other | ) |
Copy the Hoeffding tree model from the given other model.
| other | Hoeffding tree model to copy. |
| HoeffdingTreeModel& mlpack::tree::HoeffdingTreeModel::operator= | ( | HoeffdingTreeModel && | other | ) |
Move the Hoeffding tree model from the given other model.
| other | Hoeffding tree model to move. |
|
inline |
Serialize the model.
Definition at line 164 of file hoeffding_tree_model.hpp.
References mlpack::data::CreateNVP(), GINI_BINARY, GINI_HOEFFDING, giniBinaryTree, giniHoeffdingTree, INFO_BINARY, INFO_HOEFFDING, infoBinaryTree, infoHoeffdingTree, and type.
| void mlpack::tree::HoeffdingTreeModel::Train | ( | const arma::mat & | dataset, |
| const arma::Row< size_t > & | labels, | ||
| const bool | batchTraining | ||
| ) |
Train in streaming mode on the given dataset.
This takes one pass. Be sure that BuildModel() has been called first!
| dataset | Dataset to train on. |
| labels | Labels for training set. |
| batchTraining | Whether or not to train in batch. |
|
private |
This is used if we are using the Gini impurity and the binary numeric split.
Definition at line 224 of file hoeffding_tree_model.hpp.
Referenced by Serialize().
|
private |
This is used if we are using the Gini impurity and the Hoeffding numeric split.
Definition at line 220 of file hoeffding_tree_model.hpp.
Referenced by Serialize().
|
private |
This is used if we are using the information gain and the binary numeric split.
Definition at line 232 of file hoeffding_tree_model.hpp.
Referenced by Serialize().
|
private |
This is used if we are using the information gain and the Hoeffding numeric split.
Definition at line 228 of file hoeffding_tree_model.hpp.
Referenced by Serialize().
|
private |
The type of tree we are using.
Definition at line 216 of file hoeffding_tree_model.hpp.
Referenced by Serialize().
1.8.11