diff options
| author | Wu, Ke <wuke@cs.umd.edu> | 2014-10-08 07:32:42 -0400 | 
|---|---|---|
| committer | Wu, Ke <wuke@cs.umd.edu> | 2014-10-08 07:32:42 -0400 | 
| commit | 778df1879a0f38e4a8684e14e325f0a805ee8dcf (patch) | |
| tree | ca745bc0188bfc031b6dbf1645aa84047a084c80 /utils | |
| parent | 5ae503af6a1eb29d307a6af532a5fe675902558e (diff) | |
Fix an out-of-bound access bug in maxent
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/maxent.cpp | 3 | 
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;  }  | 
