summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu, Ke <wuke@cs.umd.edu>2014-10-08 07:32:42 -0400
committerWu, Ke <wuke@cs.umd.edu>2014-10-08 07:32:42 -0400
commit83a7a1e075e4bac7501fb8aaba11a5c8ecde9707 (patch)
tree740756ca42826f6103c4423f4d5efbe4687552dc
parent8c46c1eaf8ccc70488da9203ac93cb7265cd734f (diff)
Fix an out-of-bound access bug in maxent
-rw-r--r--utils/maxent.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/utils/maxent.cpp b/utils/maxent.cpp
index 8d00ac1d..9115f6f2 100644
--- a/utils/maxent.cpp
+++ b/utils/maxent.cpp
@@ -98,7 +98,7 @@ int ME_Model::conditional_probability(const Sample& s,
std::vector<double>& membp) const {
// int num_classes = membp.size();
double sum = 0;
- int max_label = -1;
+ int max_label = 0;
// double maxp = 0;
vector<double> powv(_num_classes, 0.0);
@@ -134,7 +134,6 @@ int ME_Model::conditional_probability(const Sample& s,
membp[label] /= sum;
if (membp[label] > membp[max_label]) max_label = label;
}
- assert(max_label >= 0);
return max_label;
}