15 template <
class T >
using LearnerPointer = std::shared_ptr<mltk::Learner< T > >;
17 template <
typename T =
double >
33 double EPS = 0.0000001;
47 double pred_prob = 1.0;
57 this->samples = learner.
samples;
58 this->EPS = learner.
EPS;
59 this->rate = learner.
rate;
62 this->steps = learner.
steps;
63 this->ctot = learner.
ctot;
64 this->MIN_INC = learner.
MIN_INC;
65 this->MAX_IT = learner.
MAX_IT;
66 this->MAX_UP = learner.
MAX_UP;
67 this->MAX_EPOCH = learner.MAX_EPOCH;
68 this->verbose = learner.
verbose;
69 this->seed = learner.
seed;
145 void setSeed(
const size_t _seed){ this->seed = _seed; }
155 virtual void setSamples(DataPointer< T > data) { this->samples = data; }
165 inline void setSteps(
int _steps) { this->steps = _steps; }
170 void setCtot(
int _ctot) { this->ctot = _ctot;}
190 void setEPS(
double eps) { this->EPS = eps;}
220 std::transform(data.begin(), data.end(), preds.begin(), [
this](
auto point){
221 return this->evaluate(*point);
size_t size() const
Returns the size of the dataset.
Definition: Data.hpp:208
Definition: Learner.hpp:18
int MAX_IT
Max number of iterations.
Definition: Learner.hpp:37
void setMaxUpdates(int max_up)
setMaxIterations Set the max number of updates of the Learner.
Definition: Learner.hpp:205
std::shared_ptr< Data< T > > samples
Samples used in the model training.
Definition: Learner.hpp:21
virtual void setSamples(DataPointer< T > data)
setSamples Set the samples used by the Learner.
Definition: Learner.hpp:155
void setLearningRate(double learning_rate)
Set the learning rate of the Learner.
Definition: Learner.hpp:210
void setCtot(int _ctot)
Set the partial number of updates of the Learner.
Definition: Learner.hpp:170
int ctot
Number of updates of the weights.
Definition: Learner.hpp:31
double getPredictionProbability() const
Get the probability of the last prediction.
Definition: Learner.hpp:135
double max_time
Maximum time of training.
Definition: Learner.hpp:27
virtual void setSamples(const Data< T > &data)
setSamples Set the samples used by the Learner.
Definition: Learner.hpp:150
auto getSamples()
Get the Data used by the learner.
Definition: Learner.hpp:105
virtual mltk::Point< double > batchEvaluate(const Data< T > &data)
evaluate a batch of points.
Definition: Learner.hpp:218
double rate
Learning rate.
Definition: Learner.hpp:23
double start_time
Initial time.
Definition: Learner.hpp:25
double EPS
Max precision.
Definition: Learner.hpp:33
int steps
Number of steps in the data.
Definition: Learner.hpp:29
void setStartTime(double stime)
setStartTime Set the initial time of the Learner.
Definition: Learner.hpp:180
void setSeed(const size_t _seed)
Set the seed to be used by the learner.
Definition: Learner.hpp:145
void setMaxIterations(int max_it)
setMaxIterations Set the max number of iterations of the Learner.
Definition: Learner.hpp:195
int MAX_UP
Max number of updates.
Definition: Learner.hpp:39
virtual bool train()=0
Function that execute the training phase of a Learner.
void setSteps(int _steps)
Set the partial number of steps used in the training phase of the Learner.
Definition: Learner.hpp:165
void setTimer(Timer _timer)
setTimer Set the timer used by the Learner.
Definition: Learner.hpp:160
double getMaxTime() const
getMaxTime Returns the maximum running time in the training phase of the Learner.
Definition: Learner.hpp:130
void setMaxEpochs(int MAX_EPOCHS)
Set the max number of epochs for the learner training.
Definition: Learner.hpp:200
int getCtot() const
Get the total number of updates of the Learner.
Definition: Learner.hpp:115
double MIN_INC
Minimun Increment.
Definition: Learner.hpp:35
int getUpdates() const
getUpdates Returns the number of updates needed to get to the the solution.
Definition: Learner.hpp:125
int verbose
Verbose level of the output.
Definition: Learner.hpp:42
virtual std::string getFormulationString()=0
getFormulationString Returns a string that represents the formulation of the learner (Primal or Dual)...
virtual double evaluate(const Point< T > &p, bool raw_value=false)=0
Returns the class of a feature point based on the trained Learner.
void setMaxTime(double maxtime)
Set the max time of execution.
Definition: Learner.hpp:185
size_t seed
seed for random operations.
Definition: Learner.hpp:46
void setVerbose(int _verbose)
Set the level of verbose.
Definition: Learner.hpp:175
int getSteps() const
getSteps Returns the number of steps through the data by the Learner.
Definition: Learner.hpp:120
double getElapsedTime() const
Get the elapsed time in the training phase of the Learner.
Definition: Learner.hpp:110
void setEPS(double eps)
setEPS Set the precision of the Learner.
Definition: Learner.hpp:190
Wrapper for the implementation of a simple timer.
Definition: Timer.hpp:16
A helper class to measure execution time for benchmarking purposes.
Definition: ThreadPool.hpp:503
UFJF-MLTK main namespace for core functionalities.
Definition: classifier/Classifier.hpp:11