title: Python scikit learn memory error for Kernel ridge
body: <p>I faced a memory error with running kernel ridge in python with the following environment,background,command. Appreciate public feedback on what could have gone wrong.</p>
  
  <p>Dataset: 50k+ instances of 15 features</p>
  
  <h2>Command:</h2>
  
  <pre><code>`from sklearn.kernel_ridge import KernelRidge as KRidge
  svr = KRidge(alpha=1, coef0=1, kernel='linear', gamma=None, degree=3, kernel_params=None)
  </code></pre>
  
  <p>`</p>
  
  <h2>Output:</h2>
  
  <p><strong>With sparse</strong>
  `</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\??\code.py\", line 288, in &lt;module&gt;
      main()
    File "C:\??\code.py\", line 276, in main
      svr = model_train(X_train, Y_train, model_name)
    File "C:\??\code.py\", line 231, in model_train
      svr.fit(X_train, Y_train)
    File "C:\??\Anaconda3\lib\site-packages\sklearn\kernel_ridge.py", line 149, in fit
      K = self._get_kernel(X)
    File "C:\??\Anaconda3\lib\site-packages\sklearn\kernel_ridge.py", line 121, in _get_kernel
      filter_params=True, **params)
    File "C:\??\Anaconda3\lib\site-packages\sklearn\metrics\pairwise.py", line 1399, in pairwise_kernels
      return _parallel_pairwise(X, Y, func, n_jobs, **kwds)
    File "C:\??\Anaconda3\lib\site-packages\sklearn\metrics\pairwise.py", line 1083, in _parallel_pairwise
      return func(X, Y, **kwds)
    File "C:\??\Anaconda3\lib\site-packages\sklearn\metrics\pairwise.py", line 735, in linear_kernel
      return safe_sparse_dot(X, Y.T, dense_output=True)
    File "C:\??\Anaconda3\lib\site-packages\sklearn\utils\extmath.py", line 184, in safe_sparse_dot
      ret = a * b
    File "C:\??\Anaconda3\lib\site-packages\scipy\sparse\base.py", line 369, in __mul__
      return self._mul_sparse_matrix(other)
    File "C:\??\Anaconda3\lib\site-packages\scipy\sparse\compressed.py", line 541, in _mul_sparse_matrix
      data = np.empty(nnz, dtype=upcast(self.dtype, other.dtype))
  MemoryError
  `
  
  **Without sparse**
  
  
   `Traceback (most recent call last):
        File "C:\??\code.py\", line 288, in &lt;module&gt;
          main()
        File "C:\??\code.py\", line 276, in main
          svr = model_train(X_train, Y_train, model_name)
        File "C:\??\code.py\", line 231, in model_train
          svr.fit(X_train, Y_train)
        File "C:\??\\Anaconda3\lib\site-packages\sklearn\kernel_ridge.py", line 160, in fit
          copy)
        File "C:\??\\Anaconda3\lib\site-packages\sklearn\linear_model\ridge.py", line 152, in _solve_cholesky_kernel
          overwrite_a=False)
        File "C:\??\\Anaconda3\lib\site-packages\scipy\linalg\basic.py", line 178, in solve
          overwrite_b=overwrite_b
      MemoryError
  </code></pre>
  
  <p>`</p>