summaryrefslogtreecommitdiff
path: root/training
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cab.ark.cs.cmu.edu>2012-10-16 01:42:55 -0400
committerChris Dyer <cdyer@cab.ark.cs.cmu.edu>2012-10-16 01:42:55 -0400
commit2e00c663cf271233610dc1633c7fb1d4a43cd214 (patch)
treeeffd075381b24f7d43fbb850d3b9385c4ca39034 /training
parent09a522afef40e514e741ddf5f9bbc61cfb2170e8 (diff)
c++11 compatibility
Diffstat (limited to 'training')
-rw-r--r--training/cllh_observer.cc2
-rw-r--r--training/collapse_weights.cc2
-rw-r--r--training/mpi_batch_optimize.cc2
-rw-r--r--training/mpi_online_optimize.cc4
-rw-r--r--training/mr_optimize_reduce.cc4
5 files changed, 7 insertions, 7 deletions
diff --git a/training/cllh_observer.cc b/training/cllh_observer.cc
index 58232769..4ec2fa65 100644
--- a/training/cllh_observer.cc
+++ b/training/cllh_observer.cc
@@ -45,7 +45,7 @@ void ConditionalLikelihoodObserver::NotifyAlignmentForest(const SentenceMetadata
cerr << "DIFF. ERR! log_model_z < log_ref_z: " << cur_obj << " " << log_ref_z << endl;
exit(1);
}
- assert(!isnan(log_ref_z));
+ assert(!std::isnan(log_ref_z));
acc_obj += (cur_obj - log_ref_z);
trg_words += smeta.GetReference().size();
}
diff --git a/training/collapse_weights.cc b/training/collapse_weights.cc
index dc480f6c..c03eb031 100644
--- a/training/collapse_weights.cc
+++ b/training/collapse_weights.cc
@@ -95,7 +95,7 @@ int main(int argc, char** argv) {
if (line.empty()) continue;
TRule tr(line, true);
const double lp = tr.GetFeatureValues().dot(w);
- if (isinf(lp)) { continue; }
+ if (std::isinf(lp)) { continue; }
tr.scores_.clear();
cout << tr.AsString() << " ||| F_and_E=" << lp - log(tot);
diff --git a/training/mpi_batch_optimize.cc b/training/mpi_batch_optimize.cc
index 6432f4a2..2eff07e4 100644
--- a/training/mpi_batch_optimize.cc
+++ b/training/mpi_batch_optimize.cc
@@ -142,7 +142,7 @@ struct TrainingObserver : public DecoderObserver {
cerr << "DIFF. ERR! log_model_z < log_ref_z: " << cur_obj << " " << log_ref_z << endl;
exit(1);
}
- assert(!isnan(log_ref_z));
+ assert(!std::isnan(log_ref_z));
ref_exp -= cur_model_exp;
acc_grad -= ref_exp;
acc_obj += (cur_obj - log_ref_z);
diff --git a/training/mpi_online_optimize.cc b/training/mpi_online_optimize.cc
index 993627f0..d6968848 100644
--- a/training/mpi_online_optimize.cc
+++ b/training/mpi_online_optimize.cc
@@ -143,7 +143,7 @@ struct TrainingObserver : public DecoderObserver {
cerr << "DIFF. ERR! log_model_z < log_ref_z: " << cur_obj << " " << log_ref_z << endl;
exit(1);
}
- assert(!isnan(log_ref_z));
+ assert(!std::isnan(log_ref_z));
ref_exp -= cur_model_exp;
acc_grad += ref_exp;
acc_obj += (cur_obj - log_ref_z);
@@ -330,7 +330,7 @@ int main(int argc, char** argv) {
if (rank == 0) {
converged = (iter == max_iteration);
Weights::SanityCheck(lambdas);
- Weights::ShowLargestFeatures(lambdas);
+ static int cc = 0; ++cc; if (cc > 1) { Weights::ShowLargestFeatures(lambdas); }
string fname = "weights.cur.gz";
if (iter % write_weights_every_ith == 0) {
ostringstream o; o << "weights.epoch_" << (ai+1) << '.' << iter << ".gz";
diff --git a/training/mr_optimize_reduce.cc b/training/mr_optimize_reduce.cc
index 461e6b5f..d490192f 100644
--- a/training/mr_optimize_reduce.cc
+++ b/training/mr_optimize_reduce.cc
@@ -19,8 +19,8 @@ namespace po = boost::program_options;
void SanityCheck(const vector<double>& w) {
for (int i = 0; i < w.size(); ++i) {
- assert(!isnan(w[i]));
- assert(!isinf(w[i]));
+ assert(!std::isnan(w[i]));
+ assert(!std::isinf(w[i]));
}
}