diff options
author | John Langford <jl@hunch.net> | 2012-09-12 18:38:37 +0400 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2012-09-12 18:38:37 +0400 |
commit | b940d113acdbbff47cca12280c3d3d36b0953f49 (patch) | |
tree | 730415a763a89cbcf707f0637191e9eba64189b3 /vowpalwabbit/loss_functions.cc | |
parent | 0f17540dc5c5829c262bff60d81d92b3c5e0ff49 (diff) |
added assert for logistic and hinge
Diffstat (limited to 'vowpalwabbit/loss_functions.cc')
-rw-r--r-- | vowpalwabbit/loss_functions.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/vowpalwabbit/loss_functions.cc b/vowpalwabbit/loss_functions.cc index 67acf903..d9e1ab71 100644 --- a/vowpalwabbit/loss_functions.cc +++ b/vowpalwabbit/loss_functions.cc @@ -6,6 +6,7 @@ embodied in the content of this file are licensed under the BSD #include<math.h> #include<iostream> #include<stdlib.h> +#include<assert.h> using namespace std; #include "loss_functions.h" @@ -125,6 +126,7 @@ public: } float getLoss(shared_data*, float prediction, float label) { + assert(label == -1.f || label == 1.f); float e = 1 - label*prediction; return (e > 0) ? e : 0; } @@ -168,6 +170,7 @@ public: } float getLoss(shared_data*, float prediction, float label) { + assert(label == -1.f || label == 1.f); return log(1 + exp(-label * prediction)); } |