7 #ifndef MLPACK_METHODS_HOEFFDING_TREE_HOEFFDING_TREE_MODEL_HPP 8 #define MLPACK_METHODS_HOEFFDING_TREE_HOEFFDING_TREE_MODEL_HPP 111 const arma::Row<size_t>& labels,
112 const size_t numClasses,
113 const bool batchTraining,
114 const double successProbability,
115 const size_t maxSamples,
116 const size_t checkInterval,
117 const size_t minSamples,
119 const size_t observationsBeforeBinning);
129 void Train(
const arma::mat& dataset,
130 const arma::Row<size_t>& labels,
131 const bool batchTraining);
140 void Classify(
const arma::mat& dataset,
141 arma::Row<size_t>& predictions)
const;
151 void Classify(
const arma::mat& dataset,
152 arma::Row<size_t>& predictions,
153 arma::rowvec& probabilities)
const;
163 template<
typename Archive>
169 if (Archive::is_loading::value)
187 if (Archive::is_loading::value)
194 if (Archive::is_loading::value)
201 if (Archive::is_loading::value)
208 if (Archive::is_loading::value)
InfoHoeffdingTreeType * infoHoeffdingTree
This is used if we are using the information gain and the Hoeffding numeric split.
Auxiliary information for a dataset, including mappings to/from strings and the datatype of each dime...
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.
HoeffdingTree< InformationGain, BinaryDoubleNumericSplit, HoeffdingCategoricalSplit > InfoBinaryTreeType
Convenience typedef for INFO_BINARY tree type.
BinaryNumericSplit< FitnessFunction, double > BinaryDoubleNumericSplit
size_t NumNodes() const
Get the number of nodes in the tree.
FirstShim< T > CreateNVP(T &t, const std::string &name, typename std::enable_if_t< HasSerialize< T >::value > *=0)
Call this function to produce a name-value pair; this is similar to BOOST_SERIALIZATION_NVP(), but should be used for types that have a Serialize() function (or contain a type that has a Serialize() function) instead of a serialize() function.
HoeffdingNumericSplit< FitnessFunction, double > HoeffdingDoubleNumericSplit
Convenience typedef.
TreeType
This enumerates the four types of trees we can hold.
void Classify(const arma::mat &dataset, arma::Row< size_t > &predictions) const
Using the model, classify the given test points.
GiniHoeffdingTreeType * giniHoeffdingTree
This is used if we are using the Gini impurity and the Hoeffding numeric split.
HoeffdingTree< InformationGain, HoeffdingDoubleNumericSplit, HoeffdingCategoricalSplit > InfoHoeffdingTreeType
Convenience typedef for INFO_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.
This class is a serializable Hoeffding tree model that can hold four different types of Hoeffding tre...
HoeffdingTreeModel(const TreeType &type=GINI_HOEFFDING)
Construct the Hoeffding tree model, but don't initialize any tree.
HoeffdingTree< GiniImpurity, BinaryDoubleNumericSplit, HoeffdingCategoricalSplit > GiniBinaryTreeType
Convenience typedef for GINI_BINARY tree type.
This is the standard Hoeffding-bound categorical feature proposed in the paper below: ...
~HoeffdingTreeModel()
Clean up the given model.
void Serialize(Archive &ar, const unsigned int)
Serialize the model.
TreeType type
The type of tree we are using.
void Train(const arma::mat &dataset, const arma::Row< size_t > &labels, const bool batchTraining)
Train in streaming mode on the given dataset.
InfoBinaryTreeType * infoBinaryTree
This is used if we are using the information gain and the binary numeric split.
GiniBinaryTreeType * giniBinaryTree
This is used if we are using the Gini impurity and the binary numeric split.
HoeffdingTree< GiniImpurity, HoeffdingDoubleNumericSplit, HoeffdingCategoricalSplit > GiniHoeffdingTreeType
Convenience typedef for GINI_HOEFFDING tree type.
HoeffdingTreeModel & operator=(const HoeffdingTreeModel &other)
Copy the Hoeffding tree model from the given other model.