Built-in R2 (R-squared) metric
Author: jameslambCreated Jul 28, 2025Updated Sep 1, 2026
Labelsfeature request
Description
LightGBM should add a built-in R^2 metric.
Benefits of this work
- prevents the need to implement this metric in a custom function (as seen in #6982, for example)
Acceptance criteria
- LightGBM supports an
r2metric (on both CPU and GPU)
Approach
Do something like this to find where rmse shows up:
git grep -i rmseAnd follow that as a guide for what to update.
At a minimum:
- https://github.com/microsoft/LightGBM/blob/master/src/metric/regression_metric.hpp
- https://github.com/microsoft/LightGBM/blob/master/src/metric/cuda/cuda_regression_metric.cpp
- https://github.com/microsoft/LightGBM/blob/27dcf820f30428a5e74e52e6fa0dbb271316f899/include/LightGBM/config.h#L1013
- https://github.com/microsoft/LightGBM/blob/27dcf820f30428a5e74e52e6fa0dbb271316f899/R-package/R/metrics.R#L9
Notes
This should be the standard R^2, not the "adjusted" R^2 which penalizes models with more features.
See https://en.wikipedia.org/wiki/Coefficient_of_determination
Source: lightgbm-org/LightGBM