100 {
return "RankingSvmTrainer"; }
111 std::vector<std::pair<std::size_t, std::size_t>> pairs;
112 for (std::size_t i=0; i<n; i++) {
113 for (std::size_t j=0; j<i; j++) {
114 pairs.push_back(std::make_pair(j, i));
117 train(function, dataset, pairs);
128 std::vector<std::pair<std::size_t, std::size_t>> pairs;
134 if (yi < yj) pairs.push_back(std::make_pair(i, j));
135 else if (yi > yj) pairs.push_back(std::make_pair(j, i));
156 trainInternal(function, dataset, pairs, matrix);
161 trainInternal(function, dataset, pairs, matrix);
166 template <
typename MatrixType>
170 qp.linear = RealVector(qp.dimensions(), 1.0);
171 qp.boxMin = RealVector(qp.dimensions(), 0.0);
172 qp.boxMax = RealVector(qp.dimensions(), this->C());
178 RealVector alpha = problem.getUnpermutedAlpha();
181 for (std::size_t i=0; i<alpha.size(); i++)
184 coeff(pairs[i].first) -= a;
185 coeff(pairs[i].second) += a;
187 blas::column(function.
alpha(),0) = coeff;