34 #ifndef SHARK_ALGORITHMS_TRAINERS_PERCEPTRON_H 35 #define SHARK_ALGORITHMS_TRAINERS_PERCEPTRON_H 44 template<
class InputType>
53 :mpe_kernel(kernel),m_maxTimesPattern(maxTimesPattern){}
57 {
return "Perceptron"; }
63 model.
alpha().clear();
69 for (std::size_t i = 0; i != patterns; i++){
70 double result = model(dataset.
element(i).input)(0);
72 double label = dataset.
element(i).label*2.0-1;
73 if ( result * label <= 0.0){
74 model.
alpha(i,0) += label;
78 if (iter > m_maxTimesPattern * patterns)
break;
84 std::size_t m_maxTimesPattern;