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>
97 const arma::Row<size_t>& labels,
98 const size_t numClasses,
99 const WeakLearnerType& other,
100 const size_t iterations = 100,
101 const double tolerance = 1e-6);
107 AdaBoost(
const double tolerance = 1e-6);
124 double Alpha(
const size_t i)
const {
return alpha[i]; }
126 double&
Alpha(
const size_t i) {
return alpha[i]; }
129 const WeakLearnerType&
WeakLearner(
const size_t i)
const {
return wl[i]; }
144 void Train(
const MatType& data,
145 const arma::Row<size_t>& labels,
146 const size_t numClasses,
147 const WeakLearnerType& learner,
148 const size_t iterations = 100,
149 const double tolerance = 1e-6);
158 void Classify(
const MatType& test, arma::Row<size_t>& predictedLabels);
163 template<
typename Archive>
164 void serialize(Archive& ar,
const unsigned int );
173 std::vector<WeakLearnerType> wl;
175 std::vector<double> alpha;
184 #include "adaboost_impl.hpp" const WeakLearnerType & WeakLearner(const size_t i) const
Get the given weak learner.
double Tolerance() const
Get the tolerance for stopping the optimization during training.
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t WeakLearners() const
Get the number of weak learners in the model.
size_t NumClasses() const
Get the number of classes this model is trained on.
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.
double & Alpha(const size_t i)
Modify the weight for the given weak learner (be careful!).
double & Tolerance()
Modify the tolerance for stopping the optimization during training.
double Alpha(const size_t i) const
Get the weights for the given weak learner.
void 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.
void Classify(const MatType &test, arma::Row< size_t > &predictedLabels)
Classify the given test points.
WeakLearnerType & WeakLearner(const size_t i)
Modify the given weak learner (be careful!).