summaryrefslogtreecommitdiff
path: root/utils
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
commit778df1879a0f38e4a8684e14e325f0a805ee8dcf (patch)
treeca745bc0188bfc031b6dbf1645aa84047a084c80 /utils
parent5ae503af6a1eb29d307a6af532a5fe675902558e (diff)
Fix an out-of-bound access bug in maxent
Diffstat (limited to 'utils')
-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;
}