12 #ifndef MLPACK_METHODS_HOEFFDING_TREE_HOEFFDING_TREE_MODEL_HPP 13 #define MLPACK_METHODS_HOEFFDING_TREE_HOEFFDING_TREE_MODEL_HPP 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));
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...
void serialize(Archive &ar, const uint32_t)
Serialize the model.
~HoeffdingTreeModel()
Clean up the given model.
HoeffdingTreeModel & operator=(const HoeffdingTreeModel &other)
Copy the Hoeffding tree model from the given other model.
HoeffdingTree< GiniImpurity, BinaryDoubleNumericSplit, HoeffdingCategoricalSplit > GiniBinaryTreeType
Convenience typedef for GINI_BINARY tree type.
void Classify(const arma::mat &dataset, arma::Row< size_t > &predictions) const
Using the model, classify the given test points.
HoeffdingTree< HoeffdingInformationGain, BinaryDoubleNumericSplit, HoeffdingCategoricalSplit > InfoBinaryTreeType
Convenience typedef for INFO_BINARY tree type.
The HoeffdingTree object represents all of the necessary information for a Hoeffding-bound-based deci...
Linear algebra utility functions, generally performed on matrices or vectors.
HoeffdingTreeModel(const TreeType &type=GINI_HOEFFDING)
Construct the Hoeffding tree model, but don't initialize any tree.
HoeffdingTree< HoeffdingInformationGain, HoeffdingDoubleNumericSplit, HoeffdingCategoricalSplit > InfoHoeffdingTreeType
Convenience typedef for INFO_HOEFFDING tree type.
HoeffdingTree< GiniImpurity, HoeffdingDoubleNumericSplit, HoeffdingCategoricalSplit > GiniHoeffdingTreeType
Convenience typedef for GINI_HOEFFDING tree type.
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.
BinaryNumericSplit< FitnessFunction, double > BinaryDoubleNumericSplit
TreeType
This enumerates the four types of trees we can hold.
void Train(const arma::mat &dataset, const arma::Row< size_t > &labels, const bool batchTraining)
Train in streaming mode on the given dataset.
This class is a serializable Hoeffding tree model that can hold four different types of Hoeffding tre...
size_t NumNodes() const
Get the number of nodes in the tree.
This is the standard Hoeffding-bound categorical feature proposed in the paper below: ...
HoeffdingNumericSplit< FitnessFunction, double > HoeffdingDoubleNumericSplit
Convenience typedef.
#define CEREAL_POINTER(T)
Cereal does not support the serialization of raw pointer.