diff options
author | John Langford <jl@hunch.net> | 2014-12-26 19:07:54 +0300 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2014-12-26 19:07:54 +0300 |
commit | d321880ff443a86c3ab569e8add8b917d2f5e663 (patch) | |
tree | e4b0058494a7a8186c4398648a58f44c7033a25d /vowpalwabbit | |
parent | 0f327c9fcdb3b493eae890044be823be31cd19bf (diff) |
change loss checking to loss computation
Diffstat (limited to 'vowpalwabbit')
-rw-r--r-- | vowpalwabbit/loss_functions.cc | 6 | ||||
-rw-r--r-- | vowpalwabbit/simple_label.cc | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/vowpalwabbit/loss_functions.cc b/vowpalwabbit/loss_functions.cc index 0cdc5fa7..4d67ae5e 100644 --- a/vowpalwabbit/loss_functions.cc +++ b/vowpalwabbit/loss_functions.cc @@ -127,7 +127,8 @@ public: } float getLoss(shared_data*, float prediction, float label) { - assert(label == -1.f || label == 1.f); + if (label != -1.f && label != 1.f) + cout << "You are using a label not -1 or 1 with a loss function expecting that!" << endl; float e = 1 - label*prediction; return (e > 0) ? e : 0; } @@ -170,7 +171,8 @@ public: } float getLoss(shared_data*, float prediction, float label) { - assert(label == -1.f || label == 1.f || label == FLT_MAX); + if (label != -1.f && label != 1.f) + cout << "You are using a label not -1 or 1 with a loss function expecting that!" << endl; return log(1 + exp(-label * prediction)); } diff --git a/vowpalwabbit/simple_label.cc b/vowpalwabbit/simple_label.cc index 9e220cde..3bf748de 100644 --- a/vowpalwabbit/simple_label.cc +++ b/vowpalwabbit/simple_label.cc @@ -15,8 +15,6 @@ char* bufread_simple_label(shared_data* sd, label_data* ld, char* c) { ld->label = *(float *)c; c += sizeof(ld->label); - if (sd->binary_label && fabs(ld->label) != 1.f && ld->label != FLT_MAX) - cout << "You are using a label not -1 or 1 with a loss function expecting that!" << endl; ld->weight = *(float *)c; c += sizeof(ld->weight); ld->initial = *(float *)c; |