12 #ifndef MLPACK_METHODS_HOEFFDING_TREE_HOEFFDING_TREE_MODEL_HPP 13 #define MLPACK_METHODS_HOEFFDING_TREE_HOEFFDING_TREE_MODEL_HPP 49 typedef HoeffdingTree<HoeffdingInformationGain, BinaryDoubleNumericSplit,
116 const arma::Row<size_t>& labels,
117 const size_t numClasses,
118 const bool batchTraining,
119 const double successProbability,
120 const size_t maxSamples,
121 const size_t checkInterval,
122 const size_t minSamples,
124 const size_t observationsBeforeBinning);
134 void Train(
const arma::mat& dataset,
135 const arma::Row<size_t>& labels,
136 const bool batchTraining);
145 void Classify(
const arma::mat& dataset,
146 arma::Row<size_t>& predictions)
const;
156 void Classify(
const arma::mat& dataset,
157 arma::Row<size_t>& predictions,
158 arma::rowvec& probabilities)
const;
168 template<
typename Archive>
172 if (cereal::is_loading<Archive>())
174 delete giniHoeffdingTree;
175 delete giniBinaryTree;
176 delete infoHoeffdingTree;
177 delete infoBinaryTree;
179 giniHoeffdingTree = NULL;
180 giniBinaryTree = NULL;
181 infoHoeffdingTree = NULL;
182 infoBinaryTree = NULL;
185 ar(CEREAL_NVP(type));
189 if (type == GINI_HOEFFDING)
191 else if (type == GINI_BINARY)
193 else if (type == INFO_HOEFFDING)
195 else if (type == INFO_BINARY)
205 GiniHoeffdingTreeType* giniHoeffdingTree;
209 GiniBinaryTreeType* giniBinaryTree;
213 InfoHoeffdingTreeType* infoHoeffdingTree;
217 InfoBinaryTreeType* infoBinaryTree;
Auxiliary information for a dataset, including mappings to/from strings (or other types) and the data...
Definition: dataset_mapper.hpp:41
void serialize(Archive &ar, const uint32_t)
Serialize the model.
Definition: hoeffding_tree_model.hpp:169
The HoeffdingTree object represents all of the necessary information for a Hoeffding-bound-based deci...
Definition: hoeffding_tree.hpp:61
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
HoeffdingTree< HoeffdingInformationGain, HoeffdingDoubleNumericSplit, HoeffdingCategoricalSplit > InfoHoeffdingTreeType
Convenience typedef for INFO_HOEFFDING tree type.
Definition: hoeffding_tree_model.hpp:47
HoeffdingNumericSplit< FitnessFunction, double > HoeffdingDoubleNumericSplit
Convenience typedef.
Definition: hoeffding_numeric_split.hpp:148
TreeType
This enumerates the four types of trees we can hold.
Definition: hoeffding_tree_model.hpp:31
The BinaryNumericSplit class implements the numeric feature splitting strategy devised by Gama...
Definition: binary_numeric_split.hpp:47
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.
Definition: hoeffding_tree_model.cpp:129
~HoeffdingTreeModel()
Clean up the given model.
Definition: hoeffding_tree_model.cpp:120
void Train(const arma::mat &dataset, const arma::Row< size_t > &labels, const bool batchTraining)
Train in streaming mode on the given dataset.
Definition: hoeffding_tree_model.cpp:192
This class is a serializable Hoeffding tree model that can hold four different types of Hoeffding tre...
Definition: hoeffding_tree_model.hpp:27
HoeffdingTree< GiniImpurity, BinaryDoubleNumericSplit, HoeffdingCategoricalSplit > GiniBinaryTreeType
Convenience typedef for GINI_BINARY tree type.
Definition: hoeffding_tree_model.hpp:44
This is the standard Hoeffding-bound categorical feature proposed in the paper below: ...
Definition: hoeffding_categorical_split.hpp:44
Definition: gini_impurity.hpp:21
HoeffdingTreeModel & operator=(const HoeffdingTreeModel &other)
Copy the Hoeffding tree model from the given other model.
Definition: hoeffding_tree_model.cpp:62
void Classify(const arma::mat &dataset, arma::Row< size_t > &predictions) const
Using the model, classify the given test points.
Definition: hoeffding_tree_model.cpp:218
#define CEREAL_POINTER(T)
Cereal does not support the serialization of raw pointer.
Definition: pointer_wrapper.hpp:96
size_t NumNodes() const
Get the number of nodes in the tree.
Definition: hoeffding_tree_model.cpp:289
HoeffdingTree< GiniImpurity, HoeffdingDoubleNumericSplit, HoeffdingCategoricalSplit > GiniHoeffdingTreeType
Convenience typedef for GINI_HOEFFDING tree type.
Definition: hoeffding_tree_model.hpp:41
HoeffdingTree< HoeffdingInformationGain, BinaryDoubleNumericSplit, HoeffdingCategoricalSplit > InfoBinaryTreeType
Convenience typedef for INFO_BINARY tree type.
Definition: hoeffding_tree_model.hpp:50
HoeffdingTreeModel(const TreeType &type=GINI_HOEFFDING)
Construct the Hoeffding tree model, but don't initialize any tree.
Definition: hoeffding_tree_model.cpp:20