UFJF - Machine Learning Toolkit  0.51.8
mltk::classifier::PrimalClassifier< T > Class Template Reference
Inheritance diagram for mltk::classifier::PrimalClassifier< T >:
Collaboration diagram for mltk::classifier::PrimalClassifier< T >:

Public Member Functions

 PrimalClassifier (DataPointer< T > samples)
 
 PrimalClassifier (mltk::Data< T > &samples)
 
 PrimalClassifier (const PrimalClassifier< T > &primal_learner)
 
double evaluate (const Point< T > &p, bool raw_value=false) override
 Returns the class of a feature point based on the trained Learner. More...
 
std::string getFormulationString () override
 getFormulationString Returns a string that represents the formulation of the learner (Primal or Dual). More...
 
double getP () const
 GetP Return the value of the p norm. More...
 
double getQ () const
 GetQ Return the value of the q norm. More...
 
void setqNorm (double q)
 setqNorm Set the q norm used by the classifier. (Euclidean norm is the default) More...
 
void setpNorm (double p)
 setpNorm Set the p norm used by the classifier. (Euclidean norm is the default) More...
 
void setFlexible (double flexible)
 Set flexibity of the classifier. More...
 
void setAlphaAprox (double alpha_aprox)
 Set the percentage of the aproximation. More...
 
- Public Member Functions inherited from mltk::classifier::Classifier< T >
 Classifier (DataPointer< T > samples)
 
 Classifier (const Classifier< T > &classifier)
 
virtual double evaluateProbability (const mltk::Point< double > &p)
 
mltk::Point< int > batchEvaluateProbability (const mltk::Data< T > &data)
 
Solution getSolution () const
 getSolution Returns the solution of the classifier. More...
 
SolutiongetSolutionRef ()
 getSolution Returns a reference to the solution of the classifier. More...
 
void setGamma (double gamma)
 Set the gamma (margin) of the classifier. More...
 
void setW (std::vector< double > w)
 setW Set the weights vector of the classifier. More...
 
void setSolution (Solution solution)
 setSolution Set a solution for the classifier. More...
 
- 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 mltk::Point< double > batchEvaluate (const Data< T > &data)
 evaluate a batch of points. 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::vector< double > w
 Weights vector. More...
 
double q = 2
 Norm used in the classification. (Euclidean Norm is the default) More...
 
double p = 2
 
double flexible = 0.0
 Flexibility. More...
 
double alpha_aprox = 0.0
 Percentage of aproximation of the result. More...
 
- Protected Attributes inherited from mltk::classifier::Classifier< T >
bool hasInitialSolution = false
 Inform if there's an initial solution. More...
 
std::vector< Point< T > > svs
 Support vectors points. More...
 
Solution solution
 Classifier solution. More...
 
double gamma = 0
 Classifier margin. 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
 

Member Function Documentation

◆ evaluate()

template<typename T >
double mltk::classifier::PrimalClassifier< T >::evaluate ( const Point< T > &  p,
bool  raw_value = false 
)
inlineoverridevirtual

Returns the class of a feature point based on the trained Learner.

Parameters
pPoint to be evaluated.
Returns
Prediction made by the learner.

Implements mltk::Learner< T >.

◆ getFormulationString()

template<typename T >
std::string mltk::classifier::PrimalClassifier< T >::getFormulationString ( )
inlineoverridevirtual

getFormulationString Returns a string that represents the formulation of the learner (Primal or Dual).

Returns
std::string

Implements mltk::Learner< T >.

◆ getP()

template<typename T >
double mltk::classifier::PrimalClassifier< T >::getP ( ) const
inline

GetP Return the value of the p norm.

Returns
double

◆ getQ()

template<typename T >
double mltk::classifier::PrimalClassifier< T >::getQ ( ) const
inline

GetQ Return the value of the q norm.

Returns
double

◆ setAlphaAprox()

template<typename T >
void mltk::classifier::PrimalClassifier< T >::setAlphaAprox ( double  alpha_aprox)
inline

Set the percentage of the aproximation.

Parameters
alpha_aproxAproximation.

◆ setFlexible()

template<typename T >
void mltk::classifier::PrimalClassifier< T >::setFlexible ( double  flexible)
inline

Set flexibity of the classifier.

Parameters
flexibleflexibility.

◆ setpNorm()

template<typename T >
void mltk::classifier::PrimalClassifier< T >::setpNorm ( double  p)
inline

setpNorm Set the p norm used by the classifier. (Euclidean norm is the default)

Parameters
pNorm that will be used by the classifier.

◆ setqNorm()

template<typename T >
void mltk::classifier::PrimalClassifier< T >::setqNorm ( double  q)
inline

setqNorm Set the q norm used by the classifier. (Euclidean norm is the default)

Parameters
qNorm that will be used by the classifier.

Member Data Documentation

◆ alpha_aprox

template<typename T >
double mltk::classifier::PrimalClassifier< T >::alpha_aprox = 0.0
protected

Percentage of aproximation of the result.

◆ flexible

template<typename T >
double mltk::classifier::PrimalClassifier< T >::flexible = 0.0
protected

Flexibility.

◆ q

template<typename T >
double mltk::classifier::PrimalClassifier< T >::q = 2
protected

Norm used in the classification. (Euclidean Norm is the default)

◆ w

template<typename T >
std::vector<double> mltk::classifier::PrimalClassifier< T >::w
protected

Weights vector.


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