16 using namespace shogun;
21 register_parameters();
27 register_parameters();
30 void CMulticlassOneVsOneStrategy::register_parameters()
124 if (votes[i] > vote_max)
128 dec_val_max = dec_vals[i];
130 else if (votes[i] == vote_max)
132 if (dec_vals[i] > dec_val_max)
135 dec_val_max = dec_vals[i];
163 SG_ERROR(
"%s::rescale_output(): size(outputs) is not num_machines.\n",
get_name());
179 SG_ERROR(
"%s::rescale_outputs(): Unknown OVO probability heuristic type!\n",
get_name());
189 SG_ERROR(
"%s::rescale_heuris_price(): size(outputs) = %d != m_num_machines = %d\n",
201 new_outputs[j] += 1.0 / (outputs[m]+1E-12);
203 new_outputs[j] += 1.0 / (1.0-outputs[m]+1E-12);
206 new_outputs[j] = 1.0 / (new_outputs[j] - m_num_classes + 2);
212 for (int32_t i=0; i<new_outputs.
vlen; i++)
213 outputs[i] = new_outputs[i] / norm;
221 SG_ERROR(
"%s::rescale_heuris_hastie(): size(outputs) = %d != m_num_machines = %d\n",
233 new_outputs[j] += outputs[m];
235 new_outputs[j] += 1.0-outputs[m];
238 new_outputs[j] *= 2.0 / (m_num_classes * (m_num_classes - 1));
239 new_outputs[j] += 1E-10;
248 prev_outputs = new_outputs.
clone();
251 mu[m] = new_outputs[indx1[m]] / (new_outputs[indx1[m]] + new_outputs[indx2[m]]);
273 new_outputs[j] *= numerator / denominator;
277 for (int32_t i=0; i<new_outputs.
vlen; i++)
278 new_outputs[i] /= norm;
281 for (int32_t i=0; i<new_outputs.
vlen; i++)
282 prev_outputs[i] -= new_outputs[i];
285 SG_DEBUG(
"[Hastie's heuristic] gap = %.12f\n", gap);
288 for (int32_t i=0; i<new_outputs.
vlen; i++)
289 outputs[i] = new_outputs[i];
297 SG_ERROR(
"%s::rescale_heuris_hamamura(): size(outputs) = %d != m_num_machines = %d\n",
309 new_outputs[j] *= outputs[m];
311 new_outputs[j] *= 1-outputs[m];
314 new_outputs[j] += 1E-10;
319 for (int32_t i=0; i<new_outputs.
vlen; i++)
320 outputs[i] = new_outputs[i] / norm;