90 double C = params.back();
99 KernelMatrixType km(*mep_kernel, mep_dataset->
inputs());
100 CachedMatrixType matrix(&km);
101 SVMProblemType svmProblem(matrix,mep_dataset->
labels(),C);
102 std::size_t ell = km.size();
110 ProblemType problem(svmProblem);
113 RealVector alphaFull(problem.dimensions());
114 for(std::size_t i = 0; i != problem.dimensions(); ++i){
115 alphaFull(i) = problem.alpha(i);
122 for (std::size_t i=0; i<ell; i++)
125 if (alphaFull(i) == 0.0)
continue;
126 problem.deactivateVariable(i);
135 column(svm.
alpha(),0)= problem.getUnpermutedAlpha();
136 svm.
offset(0) = computeBias(problem);
137 std::size_t elementIndex = i;
138 unsigned int target = mep_dataset->
element(elementIndex).label;
139 mistakes += loss(target, svm(mep_dataset->
element(elementIndex).input));
141 problem.activateVariable(i);
143 return mistakes / (double)ell;
149 ProblemType problem(svmProblem);
152 RealVector alphaFull(problem.dimensions());
153 for(std::size_t i = 0; i != problem.dimensions(); ++i){
154 alphaFull(i) = problem.alpha(i);
161 for (std::size_t i=0; i<ell; i++)
164 if (alphaFull(i) == 0.0)
continue;
165 problem.deactivateVariable(i);
175 column(svm.
alpha(),0)= problem.getUnpermutedAlpha();
176 std::size_t elementIndex = i;
177 unsigned int target = mep_dataset->
element(elementIndex).label;
178 mistakes += loss(target, svm(mep_dataset->
element(elementIndex).input));
180 problem.activateVariable(i);
182 return mistakes / (double)ell;