Go to the documentation of this file.
28 #ifndef MLPACK_METHODS_ADABOOST_ADABOOST_HPP
29 #define MLPACK_METHODS_ADABOOST_ADABOOST_HPP
79 template<
typename WeakLearnerType = mlpack::perceptron::Perceptron<>,
80 typename MatType = arma::mat>
98 const arma::Row<size_t>& labels,
99 const size_t numClasses,
100 const WeakLearnerType& other,
101 const size_t iterations = 100,
102 const double tolerance = 1e-6);
122 double Alpha(
const size_t i)
const {
return alpha[i]; }
124 double&
Alpha(
const size_t i) {
return alpha[i]; }
127 const WeakLearnerType&
WeakLearner(
const size_t i)
const {
return wl[i]; }
147 const arma::Row<size_t>& labels,
148 const size_t numClasses,
149 const WeakLearnerType& learner,
150 const size_t iterations = 100,
151 const double tolerance = 1e-6);
163 arma::Row<size_t>& predictedLabels,
164 arma::mat& probabilities);
174 arma::Row<size_t>& predictedLabels);
179 template<
typename Archive>
189 std::vector<WeakLearnerType> wl;
191 std::vector<double> alpha;
199 namespace serialization {
201 template<
typename WeakLearnerType,
typename MatType>
202 struct version<
mlpack::adaboost::AdaBoost<WeakLearnerType, MatType>>
211 #include "adaboost_impl.hpp"
double Tolerance() const
Get the tolerance for stopping the optimization during training.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Classify(const MatType &test, arma::Row< size_t > &predictedLabels, arma::mat &probabilities)
Classify the given test points.
size_t WeakLearners() const
Get the number of weak learners in the model.
double & Alpha(const size_t i)
Modify the weight for the given weak learner (be careful!).
double Alpha(const size_t i) const
Get the weights for the given weak learner.
Set the serialization version of the adaboost class.
void Classify(const MatType &test, arma::Row< size_t > &predictedLabels)
Classify the given test points.
size_t NumClasses() const
Get the number of classes this model is trained on.
WeakLearnerType & WeakLearner(const size_t i)
Modify the given weak learner (be careful!).
Linear algebra utility functions, generally performed on matrices or vectors.
BOOST_STATIC_CONSTANT(int, value=1)
const WeakLearnerType & WeakLearner(const size_t i) const
Get the given weak learner.
double Train(const MatType &data, const arma::Row< size_t > &labels, const size_t numClasses, const WeakLearnerType &learner, const size_t iterations=100, const double tolerance=1e-6)
Train AdaBoost on the given dataset.
void serialize(Archive &ar, const unsigned int)
Serialize the AdaBoost model.
double & Tolerance()
Modify the tolerance for stopping the optimization during training.
AdaBoost(const double tolerance=1e-6)
Create the AdaBoost object without training.
AdaBoost(const MatType &data, const arma::Row< size_t > &labels, const size_t numClasses, const WeakLearnerType &other, const size_t iterations=100, const double tolerance=1e-6)
Constructor.