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 WeakLearnerType& other,
99 const size_t iterations = 100,
100 const double tolerance = 1e-6);
106 AdaBoost(
const double tolerance = 1e-6);
123 double Alpha(
const size_t i)
const {
return alpha[i]; }
125 double&
Alpha(
const size_t i) {
return alpha[i]; }
128 const WeakLearnerType&
WeakLearner(
const size_t i)
const {
return wl[i]; }
143 void Train(
const MatType& data,
144 const arma::Row<size_t>& labels,
145 const WeakLearnerType& learner,
146 const size_t iterations = 100,
147 const double tolerance = 1e-6);
156 void Classify(
const MatType& test, arma::Row<size_t>& predictedLabels);
161 template<
typename Archive>
162 void Serialize(Archive& ar,
const unsigned int );
171 std::vector<WeakLearnerType> wl;
173 std::vector<double> alpha;
183 #include "adaboost_impl.hpp" const WeakLearnerType & WeakLearner(const size_t i) const
Get the given weak learner.
Linear algebra utility functions, generally performed on matrices or vectors.
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.
double & Alpha(const size_t i)
Modify the weight for the given weak learner (be careful!).
size_t Classes() const
Get the number of classes this model is trained on.
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 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.
AdaBoost(const MatType &data, const arma::Row< size_t > &labels, const WeakLearnerType &other, const size_t iterations=100, const double tolerance=1e-6)
Constructor.
WeakLearnerType & WeakLearner(const size_t i)
Modify the given weak learner (be careful!).
void Train(const MatType &data, const arma::Row< size_t > &labels, const WeakLearnerType &learner, const size_t iterations=100, const double tolerance=1e-6)
Train AdaBoost on the given dataset.