Skip to content

Commit

Permalink
Finally proper rejects handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Mar 10, 2012
1 parent d123ca6 commit eee5670
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/shogun/evaluation/MulticlassAccuracy.cpp
Expand Up @@ -19,7 +19,7 @@ float64_t CMulticlassAccuracy::evaluate(CLabels* predicted, CLabels* ground_trut
ASSERT(predicted->get_num_labels() == ground_truth->get_num_labels());
int32_t length = predicted->get_num_labels();
int32_t correct = 0;
if (!m_ignore_rejects)
if (m_ignore_rejects)
{
for (int32_t i=0; i<length; i++)
{
Expand All @@ -37,11 +37,11 @@ float64_t CMulticlassAccuracy::evaluate(CLabels* predicted, CLabels* ground_trut

if (predicted_label==predicted->REJECTION_LABEL)
total--;
else
else if (predicted_label==ground_truth->get_int_label(i))
correct++;

return ((float64_t)correct)/total;
}
SG_DEBUG("correct=%d, total=%d, rejected=%d\n",correct,total,length-total);
return ((float64_t)correct)/total;
}
return 0.0;
}
Expand Down
5 changes: 2 additions & 3 deletions src/shogun/machine/MulticlassMachine.cpp
Expand Up @@ -151,10 +151,9 @@ CLabels* CMulticlassMachine::classify_one_vs_rest()
for (int32_t j=0; j<num_machines; j++)
outputs_for_i[j] = outputs[j]->get_label(i);

if (m_rejection_strategy)
if (m_rejection_strategy && rejection_strategy->reject(outputs_for_i))
{
if (m_rejection_strategy->reject(outputs_for_i))
winner=result->REJECTION_LABEL;
winner=result->REJECTION_LABEL;
}
else
{
Expand Down

0 comments on commit eee5670

Please sign in to comment.