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);
108 AdaBoost(
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]; }
146 double Train(
const MatType& data,
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>
180 void serialize(Archive& ar,
const uint32_t );
189 std::vector<WeakLearnerType> wl;
191 std::vector<double> alpha;
198 #include "adaboost_impl.hpp" 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.
Definition: adaboost_impl.hpp:66
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
WeakLearnerType & WeakLearner(const size_t i)
Modify the given weak learner (be careful!).
Definition: adaboost.hpp:129
The core includes that mlpack expects; standard C++ includes and Armadillo.
The AdaBoost class.
Definition: adaboost.hpp:81
double & Alpha(const size_t i)
Modify the weight for the given weak learner (be careful!).
Definition: adaboost.hpp:124
size_t NumClasses() const
Get the number of classes this model is trained on.
Definition: adaboost.hpp:116
void Classify(const MatType &test, arma::Row< size_t > &predictedLabels, arma::mat &probabilities)
Classify the given test points.
Definition: adaboost_impl.hpp:223
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.
Definition: adaboost_impl.hpp:44
const WeakLearnerType & WeakLearner(const size_t i) const
Get the given weak learner.
Definition: adaboost.hpp:127
double Alpha(const size_t i) const
Get the weights for the given weak learner.
Definition: adaboost.hpp:122
double Tolerance() const
Get the tolerance for stopping the optimization during training.
Definition: adaboost.hpp:111
double & Tolerance()
Modify the tolerance for stopping the optimization during training.
Definition: adaboost.hpp:113
void serialize(Archive &ar, const uint32_t)
Serialize the AdaBoost model.
Definition: adaboost_impl.hpp:258
size_t WeakLearners() const
Get the number of weak learners in the model.
Definition: adaboost.hpp:119