6 #ifndef PRIMALCLASSIFIER__HPP
7 #define PRIMALCLASSIFIER__HPP
9 #include "Classifier.hpp"
12 namespace classifier {
18 std::vector<double>
w;
32 this->samples = mltk::make_data<T>(
samples);
34 PrimalClassifier<T>(
const PrimalClassifier<T> &primal_learner)
35 : Classifier<T>(primal_learner) {
36 this->q = primal_learner.q;
37 this->p = primal_learner.p;
38 this->flexible = primal_learner.flexible;
39 this->alpha_aprox = primal_learner.alpha_aprox;
46 if (p.
X().size() != dim) {
47 std::cerr <<
"The point must have the same dimension of the feature set! (" << p.
X().size()
48 <<
", " << dim <<
")" << std::endl;
56 return (func >= 0) ? 1 : -1;
69 double getP()
const {
return p; }
75 double getQ()
const {
return q; }
std::shared_ptr< Data< T > > samples
Samples used in the model training.
Definition: Learner.hpp:21
Rep const & X() const
Returns the attributes representation of the point (std::vector by default).
Definition: Point.hpp:139
std::size_t size() const
Returns the dimension of the point.
Definition: Point.hpp:133
double bias
Bias of the solution.
Definition: Solution.hpp:23
mltk::Point< double > w
Weights vector.
Definition: Solution.hpp:17
Definition: classifier/Classifier.hpp:17
Solution solution
Classifier solution.
Definition: classifier/Classifier.hpp:25
Definition: PrimalClassifier.hpp:14
double getQ() const
GetQ Return the value of the q norm.
Definition: PrimalClassifier.hpp:75
void setpNorm(double p)
setpNorm Set the p norm used by the classifier. (Euclidean norm is the default)
Definition: PrimalClassifier.hpp:91
void setqNorm(double q)
setqNorm Set the q norm used by the classifier. (Euclidean norm is the default)
Definition: PrimalClassifier.hpp:85
double q
Norm used in the classification. (Euclidean Norm is the default)
Definition: PrimalClassifier.hpp:20
double evaluate(const Point< T > &p, bool raw_value=false) override
Returns the class of a feature point based on the trained Learner.
Definition: PrimalClassifier.hpp:42
void setAlphaAprox(double alpha_aprox)
Set the percentage of the aproximation.
Definition: PrimalClassifier.hpp:103
std::string getFormulationString() override
getFormulationString Returns a string that represents the formulation of the learner (Primal or Dual)...
Definition: PrimalClassifier.hpp:63
void setFlexible(double flexible)
Set flexibity of the classifier.
Definition: PrimalClassifier.hpp:97
double getP() const
GetP Return the value of the p norm.
Definition: PrimalClassifier.hpp:69
double alpha_aprox
Percentage of aproximation of the result.
Definition: PrimalClassifier.hpp:26
std::vector< double > w
Weights vector.
Definition: PrimalClassifier.hpp:18
double flexible
Flexibility.
Definition: PrimalClassifier.hpp:24
UFJF-MLTK main namespace for core functionalities.
Definition: classifier/Classifier.hpp:11