diff --git a/src/ner/ner_frontend.cpp b/src/ner/ner_frontend.cpp index 37ac104d1..77d70f82f 100644 --- a/src/ner/ner_frontend.cpp +++ b/src/ner/ner_frontend.cpp @@ -192,9 +192,9 @@ void NamedEntityRecognizerFrontend::train(void) { INFO_LOG("report: allocate %d dimensition parameter.", model->space.dim()); int nr_groups = model->space.num_groups(); - std::vector groupwise_update_counters; + std::vector update_counts; if (train_opt.rare_feature_threshold > 0) { - groupwise_update_counters.resize(nr_groups, 0); + update_counts.resize(nr_groups, 0); INFO_LOG("report: allocate %d update-time counters", nr_groups); } else { INFO_LOG("report: model truncation is inactived."); @@ -203,7 +203,6 @@ void NamedEntityRecognizerFrontend::train(void) { int best_iteration = -1; double best_f_score = -1.; - std::vector update_counts; if (train_opt.rare_feature_threshold > 0) { update_counts.resize(nr_groups, 0); INFO_LOG("report: allocate %d update-time counters", nr_groups); @@ -232,7 +231,7 @@ void NamedEntityRecognizerFrontend::train(void) { updated_features.add(ctx.predict_features, -1.); learn(train_opt.algorithm, updated_features, - iter*train_dat.size()+1, inst->num_errors(), model); + iter*train_dat.size() + i + 1, inst->num_errors(), model); if (train_opt.rare_feature_threshold > 0) { increase_groupwise_update_counts(model, updated_features, update_counts); diff --git a/src/postagger/postagger_frontend.cpp b/src/postagger/postagger_frontend.cpp index cc3c2c897..54b4756e2 100644 --- a/src/postagger/postagger_frontend.cpp +++ b/src/postagger/postagger_frontend.cpp @@ -146,10 +146,10 @@ void PostaggerFrontend::train(void) { INFO_LOG("report: allocate %d dimensition parameter.", model->space.dim()); int nr_groups = model->space.num_groups(); - std::vector groupwise_update_counters; + std::vector update_counts; if (train_opt.rare_feature_threshold > 0) { - groupwise_update_counters.resize(nr_groups, 0); + update_counts.resize(nr_groups, 0); INFO_LOG("report: allocate %d update-time counters", nr_groups); } else { INFO_LOG("report: model truncation is inactived."); @@ -158,7 +158,6 @@ void PostaggerFrontend::train(void) { int best_iteration = -1; double best_p = -1.; - std::vector update_counts; for (int iter = 0; iter < train_opt.max_iter; ++ iter) { INFO_LOG("Training iteraition #%d", (iter + 1)); @@ -179,7 +178,7 @@ void PostaggerFrontend::train(void) { updated_features.add(ctx.predict_features, -1.); learn(train_opt.algorithm, updated_features, - iter*train_dat.size() + 1, inst->num_errors(), model); + iter*train_dat.size() + i + 1, inst->num_errors(), model); if (train_opt.rare_feature_threshold > 0) { diff --git a/src/segmentor/segmentor_frontend.cpp b/src/segmentor/segmentor_frontend.cpp index 43811e404..c040f7b7e 100644 --- a/src/segmentor/segmentor_frontend.cpp +++ b/src/segmentor/segmentor_frontend.cpp @@ -321,12 +321,12 @@ void SegmentorFrontend::train(void) { INFO_LOG("report: allocate %d dimensition parameter.", model->space.dim()); int nr_groups = model->space.num_groups(); - std::vector groupwise_update_counters; + std::vector update_counts; // If the rare feature threshold is used, allocate memory for the // feature group updated time. if (train_opt.rare_feature_threshold > 0) { - groupwise_update_counters.resize(nr_groups, 0); + update_counts.resize(nr_groups, 0); INFO_LOG("report: allocate %d update-time counters", nr_groups); } else { INFO_LOG("report: model truncation is inactived."); @@ -335,7 +335,6 @@ void SegmentorFrontend::train(void) { int best_iteration = -1; double best_p = -1., best_r = -1., best_f = -1.; - std::vector update_counts; for (size_t iter = 0; iter < train_opt.max_iter; ++ iter) { INFO_LOG("Training iteration #%d", (iter + 1));