Describe the bug
cuml.linear_model.Lars produces an incorrect fitted model for a simple one-feature dataset that follows the exact linear relationship y = X.
For:
X = np.array([[1], [2], [3]])
y = np.array([1, 2, 3])
the equivalent sklearn.linear_model.Lars model correctly recovers a coefficient of 1.0, an intercept numerically equal to zero, exact predictions [1.0, 2.0, 3.0], and an R² score of 1.0.
cuML instead returns:
coef: [0.14285713]
intercept: 2.0
pred: [2.142857 2.2857141 2.4285715]
score: 0.14285727909631873
The discrepancy affects the fitted parameters as well as downstream predict() and score() results.
Steps/Code to reproduce bug
cuML reproducer:
import numpy as np
from cuml.linear_model import Lars
X = np.array([[1], [2], [3]])
y = np.array([1, 2, 3])
m = Lars().fit(X, y)
print("coef:", m.coef_)
print("intercept:", m.intercept_)
print("pred:", m.predict(X))
print("score:", m.score(X, y))
Output:
coef: [0.14285713]
intercept: 2.0
pred: [2.142857 2.2857141 2.4285715]
score: 0.14285727909631873
For comparison, the equivalent scikit-learn code:
import numpy as np
from sklearn.linear_model import Lars
X = np.array([[1], [2], [3]])
y = np.array([1, 2, 3])
m = Lars().fit(X, y)
print("coef:", m.coef_)
print("intercept:", m.intercept_)
print("pred:", m.predict(X))
print("score:", m.score(X, y))
Output:
coef: [1.]
intercept: 4.440892098500626e-16
pred: [1. 2. 3.]
score: 1.0
Expected behavior
For this dataset, the target follows the exact linear relationship:
Therefore, Lars().fit(X, y) should recover a coefficient approximately equal to 1.0 and an intercept approximately equal to 0.0.
Predictions on the training samples should be approximately:
and the coefficient of determination should be:
The cuML implementation should produce a fitted model consistent with this exact solution and with the equivalent scikit-learn estimator.
Environment details (please complete the following information):
- Environment location: Docker
- Linux Distro/Architecture: Ubuntu 24.04 / x86_64
- GPU Model/Driver: NVIDIA GeForce RTX 4090 / 595.71.05
- CUDA: 13.2
- Method of cuDF & cuML install: conda
conda list:
# packages in environment at /opt/conda/envs/rapids-26.08:
#
# Name Version Build Channel
python 3.14.6 h242f9ac_102_cp314 conda-forge
numpy 2.4.6 py314h2b28147_0 conda-forge
scipy 1.16.3 py314hf07bd8e_2 conda-forge
scikit-learn 1.9.0 np2py314hf09ca88_0 conda-forge
rapids 26.08.00 cuda13_260806_c2656556 rapidsai
cuml 26.08.00 cuda13_cp311_abi3_260805_265b9da6 rapidsai
libcuml 26.08.00 cuda13_260805_265b9da6 rapidsai
cudf 26.08.00 cuda13_cp311_abi3_260805_ff5b362d rapidsai
libraft 26.08.00 cuda13_260805_ebf92684 rapidsai
libraft-headers 26.08.00 cuda13_260805_ebf92684 rapidsai
pylibraft 26.08.00 cuda13_cp311_abi3_260805_ebf92684 rapidsai
cuvs 26.08.01 cuda13_cp311_abi3_260806_25b1be43 rapidsai
libcuvs 26.08.01 cuda13_260806_25b1be43 rapidsai
cupy 14.1.1 py314hdea9c46_0 conda-forge
cupy-core 14.1.1 py314hcd3b49b_0 conda-forge
numba 0.64.0 py314h8169c2f_0 conda-forge
numba-cuda 0.30.4 py314h42812f9_0 conda-forge
rmm 26.08.00 cuda13_cp311_abi3_260805_42d059f1 rapidsai
librmm 26.08.00 cuda13_260805_42d059f1 rapidsai
cuda-version 13.3 hcbadf70_3 conda-forge
cuda-bindings 13.3.1 py314h42812f9_1 conda-forge
cuda-cudart 13.3.29 hecca717_0 conda-forge
cuda-nvrtc 13.3.33 hecca717_0 conda-forge
libcublas 13.6.0.2 h676940d_0 conda-forge
libcusolver 12.2.6.9 h676940d_0 conda-forge
libcusparse 12.8.2.51 hecca717_0 conda-forge
libcurand 10.4.3.29 h676940d_0 conda-forge
Additional context
This reproducer is intentionally minimal. It contains only one feature and three samples, and the target is exactly equal to the feature value:
X = [[1],
[2],
[3]]
y = [1, 2, 3]
There is no noise, no multicollinearity, and no ambiguity in the expected linear solution.
The scikit-learn implementation recovers:
coef = [1.]
intercept ≈ 0
which exactly explains the data.
By contrast, cuML returns:
coef = [0.14285713]
intercept = 2.0
which corresponds to predictions shifted toward the target mean and leaves most of the variance unexplained.
Because the error is already visible in coef_ and intercept_, the incorrect predict() and score() results appear to be consequences of an incorrect fitted Lars solution rather than isolated issues in those methods.
Describe the bug
cuml.linear_model.Larsproduces an incorrect fitted model for a simple one-feature dataset that follows the exact linear relationshipy = X.For:
the equivalent
sklearn.linear_model.Larsmodel correctly recovers a coefficient of1.0, an intercept numerically equal to zero, exact predictions[1.0, 2.0, 3.0], and anR²score of1.0.cuML instead returns:
The discrepancy affects the fitted parameters as well as downstream
predict()andscore()results.Steps/Code to reproduce bug
cuML reproducer:
Output:
For comparison, the equivalent scikit-learn code:
Output:
Expected behavior
For this dataset, the target follows the exact linear relationship:
Therefore,
Lars().fit(X, y)should recover a coefficient approximately equal to1.0and an intercept approximately equal to0.0.Predictions on the training samples should be approximately:
and the coefficient of determination should be:
The cuML implementation should produce a fitted model consistent with this exact solution and with the equivalent scikit-learn estimator.
Environment details (please complete the following information):
conda list:Additional context
This reproducer is intentionally minimal. It contains only one feature and three samples, and the target is exactly equal to the feature value:
There is no noise, no multicollinearity, and no ambiguity in the expected linear solution.
The scikit-learn implementation recovers:
which exactly explains the data.
By contrast, cuML returns:
which corresponds to predictions shifted toward the target mean and leaves most of the variance unexplained.
Because the error is already visible in
coef_andintercept_, the incorrectpredict()andscore()results appear to be consequences of an incorrect fitted Lars solution rather than isolated issues in those methods.