UFJF - Machine Learning Toolkit  0.51.8
mltk::Learner< T > Class Template Referenceabstract
Inheritance diagram for mltk::Learner< T >:
Collaboration diagram for mltk::Learner< T >:

Public Member Functions

 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...
 
virtual void setSamples (DataPointer< 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

std::shared_ptr< Data< T > > samples
 Samples used in the model training. More...
 
double rate = 0.5f
 Learning rate. More...
 
double start_time = 0.0f
 Initial time. More...
 
double max_time = 110
 Maximum time of training. More...
 
int steps = 0
 Number of steps in the data. More...
 
int ctot = 0
 Number of updates of the weights. More...
 
double EPS = 0.0000001
 Max precision. More...
 
double MIN_INC = 1.001
 Minimun Increment. More...
 
int MAX_IT = 1E9
 Max number of iterations. More...
 
int MAX_UP = 1E9
 Max number of updates. More...
 
int MAX_EPOCH = 1E9
 
int verbose = 1
 Verbose level of the output. More...
 
Timer timer = Timer()
 Timer used to measure the time elapsed in the execution of a Learner. More...
 
size_t seed = 0
 seed for random operations. More...
 
double pred_prob = 1.0
 

Member Function Documentation

◆ batchEvaluate()

template<typename T >
mltk::Point< double > mltk::Learner< T >::batchEvaluate ( const Data< T > &  data)
virtual

evaluate a batch of points.

Parameters
datadataset containing points for evaluation.
Returns
copy of the passed data already evaluated.

◆ evaluate()

◆ getCtot()

template<typename T = double>
int mltk::Learner< T >::getCtot ( ) const
inline

Get the total number of updates of the Learner.

Returns
int

◆ getElapsedTime()

template<typename T = double>
double mltk::Learner< T >::getElapsedTime ( ) const
inline

Get the elapsed time in the training phase of the Learner.

Returns
double

◆ getFormulationString()

◆ getMaxTime()

template<typename T = double>
double mltk::Learner< T >::getMaxTime ( ) const
inline

getMaxTime Returns the maximum running time in the training phase of the Learner.

Returns
double

◆ getPredictionProbability()

template<typename T = double>
double mltk::Learner< T >::getPredictionProbability ( ) const
inline

Get the probability of the last prediction.

Returns
Last prediction probability.

◆ getSamples()

template<typename T = double>
auto mltk::Learner< T >::getSamples ( )
inline

Get the Data used by the learner.

Returns
Data object.

◆ getSteps()

template<typename T = double>
int mltk::Learner< T >::getSteps ( ) const
inline

getSteps Returns the number of steps through the data by the Learner.

Returns
int

◆ getUpdates()

template<typename T = double>
int mltk::Learner< T >::getUpdates ( ) const
inline

getUpdates Returns the number of updates needed to get to the the solution.

Returns
int

◆ setCtot()

template<typename T = double>
void mltk::Learner< T >::setCtot ( int  _ctot)
inline

Set the partial number of updates of the Learner.

Parameters
_ctotNumber of updates.

◆ setEPS()

template<typename T = double>
void mltk::Learner< T >::setEPS ( double  eps)
inline

setEPS Set the precision of the Learner.

Parameters
epsPrecision.

◆ setLearningRate()

template<typename T = double>
void mltk::Learner< T >::setLearningRate ( double  learning_rate)
inline

Set the learning rate of the Learner.

Parameters
learning_rateLearning rate.

◆ setMaxEpochs()

template<typename T = double>
void mltk::Learner< T >::setMaxEpochs ( int  MAX_EPOCHS)
inline

Set the max number of epochs for the learner training.

Parameters
MAX_EPOCHSMax number of epochs.

◆ setMaxIterations()

template<typename T = double>
void mltk::Learner< T >::setMaxIterations ( int  max_it)
inline

setMaxIterations Set the max number of iterations of the Learner.

Parameters
max_itNumber max of iterations.

◆ setMaxTime()

template<typename T = double>
void mltk::Learner< T >::setMaxTime ( double  maxtime)
inline

Set the max time of execution.

Parameters
maxtimeMax time.

◆ setMaxUpdates()

template<typename T = double>
void mltk::Learner< T >::setMaxUpdates ( int  max_up)
inline

setMaxIterations Set the max number of updates of the Learner.

Parameters
MAX_ITNumber max of updates.

◆ setSamples() [1/2]

template<typename T = double>
virtual void mltk::Learner< T >::setSamples ( const Data< T > &  data)
inlinevirtual

setSamples Set the samples used by the Learner.

Parameters
dataSamples to be used.

◆ setSamples() [2/2]

template<typename T = double>
virtual void mltk::Learner< T >::setSamples ( DataPointer< T >  data)
inlinevirtual

setSamples Set the samples used by the Learner.

Parameters
dataSamples to be used.

Reimplemented in mltk::ensemble::Ensemble< T >.

◆ setSeed()

template<typename T = double>
void mltk::Learner< T >::setSeed ( const size_t  _seed)
inline

Set the seed to be used by the learner.

Parameters
_seedSeed to be used.

◆ setStartTime()

template<typename T = double>
void mltk::Learner< T >::setStartTime ( double  stime)
inline

setStartTime Set the initial time of the Learner.

Parameters
stimeInitial time.

◆ setSteps()

template<typename T = double>
void mltk::Learner< T >::setSteps ( int  _steps)
inline

Set the partial number of steps used in the training phase of the Learner.

Parameters
_stepsNumber of steps.

◆ setTimer()

template<typename T = double>
void mltk::Learner< T >::setTimer ( Timer  _timer)
inline

setTimer Set the timer used by the Learner.

Parameters
_timerTimer to be used.

◆ setVerbose()

template<typename T = double>
void mltk::Learner< T >::setVerbose ( int  _verbose)
inline

Set the level of verbose.

Parameters
_verboselevel of verbose.

◆ train()

Member Data Documentation

◆ ctot

template<typename T = double>
int mltk::Learner< T >::ctot = 0
protected

Number of updates of the weights.

◆ EPS

template<typename T = double>
double mltk::Learner< T >::EPS = 0.0000001
protected

Max precision.

◆ MAX_IT

template<typename T = double>
int mltk::Learner< T >::MAX_IT = 1E9
protected

Max number of iterations.

◆ max_time

template<typename T = double>
double mltk::Learner< T >::max_time = 110
protected

Maximum time of training.

◆ MAX_UP

template<typename T = double>
int mltk::Learner< T >::MAX_UP = 1E9
protected

Max number of updates.

◆ MIN_INC

template<typename T = double>
double mltk::Learner< T >::MIN_INC = 1.001
protected

Minimun Increment.

◆ rate

template<typename T = double>
double mltk::Learner< T >::rate = 0.5f
protected

Learning rate.

◆ samples

template<typename T = double>
std::shared_ptr<Data< T > > mltk::Learner< T >::samples
protected

Samples used in the model training.

◆ seed

template<typename T = double>
size_t mltk::Learner< T >::seed = 0
protected

seed for random operations.

◆ start_time

template<typename T = double>
double mltk::Learner< T >::start_time = 0.0f
protected

Initial time.

◆ steps

template<typename T = double>
int mltk::Learner< T >::steps = 0
protected

Number of steps in the data.

◆ timer

template<typename T = double>
Timer mltk::Learner< T >::timer = Timer()
protected

Timer used to measure the time elapsed in the execution of a Learner.

◆ verbose

template<typename T = double>
int mltk::Learner< T >::verbose = 1
protected

Verbose level of the output.


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