UFJF - Machine Learning Toolkit  0.51.8
mltk::ensemble::Ensemble< T > Class Template Reference

Namespace for ensemble methods. More...

#include <Ensemble.hpp>

Inheritance diagram for mltk::ensemble::Ensemble< T >:
Collaboration diagram for mltk::ensemble::Ensemble< T >:

Public Member Functions

 Ensemble (DataPointer< T > samples)
 
Solution getSolution () const
 getSolution Returns the solution of the Ensemble method. More...
 
SolutiongetSolutionRef ()
 getSolution Returns a reference to the solution of the Ensemble method. More...
 
void setLearner (Learner< T > *learner)
 setLearner Set the base learner to be used by the ensemble method. Make sure to set the base learner parameters before setting it. More...
 
void setSamples (DataPointer< T > samples) override
 setSamples Set the samples used by the Learner. More...
 
void setCommitteeSize (size_t c_size)
 setCommitteeSize Set the learner committee size. More...
 
size_t size ()
 
auto begin ()
 
auto end ()
 
LearnerPointer< T > operator[] (size_t idx) const
 
auto learners ()
 
- Public Member Functions inherited from mltk::Learner< T >
 Learner (DataPointer< T > _samples)
 
 Learner (const Learner< T > &learner)
 
virtual bool train ()=0
 Function that execute the training phase of a Learner. More...
 
virtual double evaluate (const Point< T > &p, bool raw_value=false)=0
 Returns the class of a feature point based on the trained Learner. More...
 
virtual mltk::Point< double > batchEvaluate (const Data< T > &data)
 evaluate a batch of points. More...
 
virtual std::string getFormulationString ()=0
 getFormulationString Returns a string that represents the formulation of the learner (Primal or Dual). More...
 
auto getSamples ()
 Get the Data used by the learner. More...
 
double getElapsedTime () const
 Get the elapsed time in the training phase of the Learner. More...
 
int getCtot () const
 Get the total number of updates of the Learner. More...
 
int getSteps () const
 getSteps Returns the number of steps through the data by the Learner. More...
 
int getUpdates () const
 getUpdates Returns the number of updates needed to get to the the solution. More...
 
double getMaxTime () const
 getMaxTime Returns the maximum running time in the training phase of the Learner. More...
 
double getPredictionProbability () const
 Get the probability of the last prediction. More...
 
void setSeed (const size_t _seed)
 Set the seed to be used by the learner. More...
 
virtual void setSamples (const Data< T > &data)
 setSamples Set the samples used by the Learner. More...
 
void setTimer (Timer _timer)
 setTimer Set the timer used by the Learner. More...
 
void setSteps (int _steps)
 Set the partial number of steps used in the training phase of the Learner. More...
 
void setCtot (int _ctot)
 Set the partial number of updates of the Learner. More...
 
void setVerbose (int _verbose)
 Set the level of verbose. More...
 
void setStartTime (double stime)
 setStartTime Set the initial time of the Learner. More...
 
void setMaxTime (double maxtime)
 Set the max time of execution. More...
 
void setEPS (double eps)
 setEPS Set the precision of the Learner. More...
 
void setMaxIterations (int max_it)
 setMaxIterations Set the max number of iterations of the Learner. More...
 
void setMaxEpochs (int MAX_EPOCHS)
 Set the max number of epochs for the learner training. More...
 
void setMaxUpdates (int max_up)
 setMaxIterations Set the max number of updates of the Learner. More...
 
void setLearningRate (double learning_rate)
 Set the learning rate of the Learner. More...
 

Protected Attributes

size_t c_size {}
 Committee size. More...
 
std::vector< LearnerPointer< T > > m_learners
 Pointer to base learner used by the ensemble method. More...
 
Solution solution
 Ensemble solution. More...
 
- Protected Attributes inherited from mltk::Learner< T >
std::shared_ptr< Data< T > > samples
 Samples used in the model training. More...
 
double rate
 Learning rate. More...
 
double start_time
 Initial time. More...
 
double max_time
 Maximum time of training. More...
 
int steps
 Number of steps in the data. More...
 
int ctot
 Number of updates of the weights. More...
 
double EPS
 Max precision. More...
 
double MIN_INC
 Minimun Increment. More...
 
int MAX_IT
 Max number of iterations. More...
 
int MAX_UP
 Max number of updates. More...
 
int MAX_EPOCH
 
int verbose
 Verbose level of the output. More...
 
Timer timer
 Timer used to measure the time elapsed in the execution of a Learner. More...
 
size_t seed
 seed for random operations. More...
 
double pred_prob
 

Detailed Description

template<typename T>
class mltk::ensemble::Ensemble< T >

Namespace for ensemble methods.

Member Function Documentation

◆ getSolution()

template<typename T >
Solution mltk::ensemble::Ensemble< T >::getSolution ( ) const
inline

getSolution Returns the solution of the Ensemble method.

Returns
Solution

◆ getSolutionRef()

template<typename T >
Solution* mltk::ensemble::Ensemble< T >::getSolutionRef ( )
inline

getSolution Returns a reference to the solution of the Ensemble method.

Returns
Solution

◆ setCommitteeSize()

template<typename T >
void mltk::ensemble::Ensemble< T >::setCommitteeSize ( size_t  c_size)
inline

setCommitteeSize Set the learner committee size.

Returns
void

◆ setLearner()

template<typename T >
void mltk::ensemble::Ensemble< T >::setLearner ( Learner< T > *  learner)
inline

setLearner Set the base learner to be used by the ensemble method. Make sure to set the base learner parameters before setting it.

Returns
void

◆ setSamples()

template<typename T >
void mltk::ensemble::Ensemble< T >::setSamples ( DataPointer< T >  data)
inlineoverridevirtual

setSamples Set the samples used by the Learner.

Parameters
dataSamples to be used.

Reimplemented from mltk::Learner< T >.

Member Data Documentation

◆ c_size

template<typename T >
size_t mltk::ensemble::Ensemble< T >::c_size {}
protected

Committee size.

◆ m_learners

template<typename T >
std::vector< LearnerPointer< T > > mltk::ensemble::Ensemble< T >::m_learners
protected

Pointer to base learner used by the ensemble method.

◆ solution

template<typename T >
Solution mltk::ensemble::Ensemble< T >::solution
protected

Ensemble solution.


The documentation for this class was generated from the following file: