1
$\begingroup$

I am fitting a model with 100,000 samples x 10 features (6 ints and 4 floats), using SKLearn KernelRidge:

model = KernelRidge(kernel='linear')

Looking at the task manager, 'Python' process takes ~40GB.

Can you please explain why is there such a high demand? What kind of matrix is built in the background?

$\endgroup$
1
$\begingroup$

This is rather common. The algorithm for KernelRidge requires a SVD to be performed. Sadly, the SVD cannot handle a sparse matrix so the _pre_compute_svd function in sklearn just converts the matrix into a dense matrix and moves on. This tends to blow up memory rather quickly.

You have a couple of choices. Rewrite the method to handle sparse matrices or just use a different method. SVR would be the most similiar alternative.

$\endgroup$
1
  • $\begingroup$ But my input matrix is not sparse. So how would that help? $\endgroup$
    – Eran
    Mar 8 '18 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.