Skip to content

Commit

Permalink
Fix integer overflow in auc_mu. (#3209)
Browse files Browse the repository at this point in the history
  • Loading branch information
btrotta authored Jul 7, 2020
1 parent d8bc0fc commit 1e2013a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/metric/multiclass_metric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ class AucMuMetric : public Metric {
double ans = 0;
for (int i = 0; i < num_class_; ++i) {
for (int j = i + 1; j < num_class_; ++j) {
ans += S[i][j] / (class_sizes[i] * class_sizes[j]);
ans += (S[i][j] / class_sizes[i]) / class_sizes[j];
}
}
ans = 2 * ans / (num_class_ * (num_class_ - 1));
ans = (2 * ans / num_class_) / (num_class_ - 1);
return std::vector<double>(1, ans);
}

Expand Down

0 comments on commit 1e2013a

Please sign in to comment.