diff options
author | Chris Dyer <cdyer@cab.ark.cs.cmu.edu> | 2012-06-18 20:42:27 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cab.ark.cs.cmu.edu> | 2012-06-18 20:42:27 -0400 |
commit | b89da66b5bc922148cb4ec2b30cc751c827c9f64 (patch) | |
tree | ed0734c6b944c6bcc53c3a4a2847add8c036d1bc /rst_parser | |
parent | 67456f9f7af754750faeea6f1e66b14b910d8751 (diff) |
fixes for non-const iterator
Diffstat (limited to 'rst_parser')
-rw-r--r-- | rst_parser/mst_train.cc | 2 | ||||
-rw-r--r-- | rst_parser/rst_train.cc | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/rst_parser/mst_train.cc b/rst_parser/mst_train.cc index 6332693e..a78df600 100644 --- a/rst_parser/mst_train.cc +++ b/rst_parser/mst_train.cc @@ -176,7 +176,7 @@ int main(int argc, char** argv) { for (int iter = 0; iter < iterations; ++iter) { cerr << "ITERATION " << iter << " " << flush; fill(g.begin(), g.end(), 0.0); - for (SparseVector<double>::const_iterator it = empirical.begin(); it != empirical.end(); ++it) + for (SparseVector<double>::iterator it = empirical.begin(); it != empirical.end(); ++it) g[it->first] = -it->second; double obj = -empirical.dot(weights); vector<boost::shared_ptr<GradientWorker> > jobs; diff --git a/rst_parser/rst_train.cc b/rst_parser/rst_train.cc index 9b730f3d..a8b8dd84 100644 --- a/rst_parser/rst_train.cc +++ b/rst_parser/rst_train.cc @@ -126,12 +126,12 @@ int main(int argc, char** argv) { u.logeq(tot_feats.dot(weights)); prob_t w = u / q; zhat += w; - for (SparseVector<double>::const_iterator it = tot_feats.begin(); it != tot_feats.end(); ++it) + for (SparseVector<double>::iterator it = tot_feats.begin(); it != tot_feats.end(); ++it) sampled_exp.add_value(it->first, w * prob_t(it->second)); } sampled_exp /= zhat; SparseVector<double> tot_m; - for (SparseVector<prob_t>::const_iterator it = sampled_exp.begin(); it != sampled_exp.end(); ++it) + for (SparseVector<prob_t>::iterator it = sampled_exp.begin(); it != sampled_exp.end(); ++it) tot_m.add_value(it->first, it->second.as_float()); //cerr << "DIFF: " << (tot_m - corpus[i].features) << endl; const double eta = 0.03; |