Python scikit学习内核脊的内存错误

时间:2017-10-09 05:59:35

标签: python scikit-learn

我遇到了内存错误,在python中使用以下环境,后台,命令运行内核。感谢公众对可能出现问题的反馈。

数据集:50个+ 15个功能的实例

命令:

`from sklearn.kernel_ridge import KernelRidge as KRidge
svr = KRidge(alpha=1, coef0=1, kernel='linear', gamma=None, degree=3, kernel_params=None)

`

输出:

稀疏 `

Traceback (most recent call last):
  File "C:\??\code.py\", line 288, in <module>
    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 <module>
        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

`

0 个答案:

没有答案