rapidsai / cuml

cuML - RAPIDS Machine Learning Library
https://docs.rapids.ai/api/cuml/stable/
Apache License 2.0
4.25k stars 534 forks source link

[BUG] Ridge Regressor, solver='cd' resulted in no algorithm has been implemented #6066

Open AquifersBSIM opened 2 months ago

AquifersBSIM commented 2 months ago

Describe the bug I am running into an issue with using ridge regressor in the cuml library. When using the solver = 'cd', an error appeared that said the following: "no algorithm with this id has been implemented" the following is just an example script, to reproduce the error.

Steps/Code to reproduce bug

import cuml
print(cuml.__version__)

from cuml.linear_model import Ridge
import cuml
import cupy as cp

# Test data
X = cp.random.rand(100, 10)
y = cp.random.rand(100)

# Ridge regression with 'cd' solver
ridge = Ridge(alpha=1.0, solver='cd')
ridge.fit(X, y)

Expected behavior

Traceback (most recent call last):
  File "/fred/oz310/BSIM/RR_sandbox/single-gpu-2/v2/tmp/1.py", line 14, in <module>
    ridge.fit(X, y)
  File "/fred/oz241/BSIM/conda_SVM/SVM/lib/python3.11/site-packages/cuml/internals/api_decorators.py", line 188, in wrapper
    ret = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/fred/oz241/BSIM/conda_SVM/SVM/lib/python3.11/site-packages/cuml/internals/api_decorators.py", line 393, in dispatch
    return self.dispatch_func(func_name, gpu_func, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/fred/oz241/BSIM/conda_SVM/SVM/lib/python3.11/site-packages/cuml/internals/api_decorators.py", line 190, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "base.pyx", line 687, in cuml.internals.base.UniversalBase.dispatch_func
  File "ridge.pyx", line 324, in cuml.linear_model.ridge.Ridge.fit
RuntimeError: exception occurred! file=/opt/conda/conda-bld/work/cpp/src/glm/ridge.cuh line=215: ridgeFit: no algorithm with this id has been implemented
Obtained 21 stack frames
#1 in /fred/oz241/BSIM/conda_SVM/SVM/lib/python3.11/site-packages/cuml/internals/../../../../libcuml++.so(+0x20ed2f) [0x1544bc37dd2f]
#2 in /fred/oz241/BSIM/conda_SVM/SVM/lib/python3.11/site-packages/cuml/linear_model/ridge.cpython-311-x86_64-linux-gnu.so(+0x26eee) [0x1543cdab8eee]
#3 in /fred/oz241/BSIM/conda_SVM/SVM/lib/python3.11/site-packages/cuml/internals/base.cpython-311-x86_64-linux-gnu.so(+0xfa5f) [0x1543cf39ca5f]
#4 in /fred/oz241/BSIM/conda_SVM/SVM/lib/python3.11/site-packages/cuml/internals/base.cpython-311-x86_64-linux-gnu.so(+0x1c041) [0x1543cf3a9041]
#5 in python: _PyEval_EvalFrameDefault +0x4a44 [0x562ae435e6e4]
#6 in python(+0x22ffc2) [0x562ae439bfc2]
#7 in python: _PyEval_EvalFrameDefault +0x4a44 [0x562ae435e6e4]
#8 in python: _PyFunction_Vectorcall +0x181 [0x562ae437d981]
#9 in python: _PyEval_EvalFrameDefault +0x4a44 [0x562ae435e6e4]
#10 in python(+0x2a5a8d) [0x562ae4411a8d]
#11 in python: PyEval_EvalCode +0x9f [0x562ae441111f]
#12 in python(+0x2c408a) [0x562ae443008a]
#13 in python(+0x2bfc13) [0x562ae442bc13]
#14 in python(+0x2d4fb0) [0x562ae4440fb0]
#15 in python: _PyRun_SimpleFileObject +0x1ae [0x562ae444094e]
#16 in python: _PyRun_AnyFileObject +0x44 [0x562ae4440674]
#17 in python: Py_RunMain +0x374 [0x562ae443ad14]
#18 in python: Py_BytesMain +0x37 [0x562ae4401027]
#19 in /lib64/libc.so.6(+0x29590) [0x1544ec580590]
#20 in /lib64/libc.so.6: __libc_start_main +0x80 [0x1544ec580640]
#21 in python(+0x294ecd) [0x562ae4400ecd]

Environment details (please complete the following information):

Additional context Other solver such as 'eig' works just fine.

dantegd commented 1 month ago

Thanks for the issue @AquifersBSIM, indeed we have the CD solver but it isn't currently an option to have Ridge using it. It is something in the backlog, but is there a specific reason you need CD solver?