Commit 834a8986 authored by Guolin Ke's avatar Guolin Ke
Browse files

fix bugs in goss.

parent fd5b5916
...@@ -226,10 +226,10 @@ void Application::Train() { ...@@ -226,10 +226,10 @@ void Application::Train() {
int total_iter = config_.boosting_config.num_iterations; int total_iter = config_.boosting_config.num_iterations;
bool is_finished = false; bool is_finished = false;
bool need_eval = true; bool need_eval = true;
auto start_time = std::chrono::high_resolution_clock::now(); auto start_time = std::chrono::steady_clock::now();
for (int iter = 0; iter < total_iter && !is_finished; ++iter) { for (int iter = 0; iter < total_iter && !is_finished; ++iter) {
is_finished = boosting_->TrainOneIter(nullptr, nullptr, need_eval); is_finished = boosting_->TrainOneIter(nullptr, nullptr, need_eval);
auto end_time = std::chrono::high_resolution_clock::now(); auto end_time = std::chrono::steady_clock::now();
// output used time per iteration // output used time per iteration
Log::Info("%f seconds elapsed, finished iteration %d", std::chrono::duration<double, Log::Info("%f seconds elapsed, finished iteration %d", std::chrono::duration<double,
std::milli>(end_time - start_time) * 1e-3, iter + 1); std::milli>(end_time - start_time) * 1e-3, iter + 1);
......
...@@ -102,8 +102,11 @@ public: ...@@ -102,8 +102,11 @@ public:
double prob = (rest_need) / static_cast<double>(rest_all); double prob = (rest_need) / static_cast<double>(rest_all);
if (cur_rand.NextFloat() < prob) { if (cur_rand.NextFloat() < prob) {
buffer[cur_left_cnt++] = start + i; buffer[cur_left_cnt++] = start + i;
gradients_[start + i] *= multiply; for (int curr_class = 0; curr_class < num_class_; ++curr_class) {
hessians_[start + i] *= multiply; int idx = curr_class * num_data_ + start + i;
gradients_[idx] *= multiply;
hessians_[idx] *= multiply;
}
} else { } else {
buffer_right[cur_right_cnt++] = start + i; buffer_right[cur_right_cnt++] = start + i;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment