8000 LinearSVC doesn't deepcopy properly · Issue #820 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
LinearSVC doesn't deepcopy properly #820
Closed
@bwhite

Description

@bwhite
import sklearn.svm
import numpy as np
import copy
c = sklearn.svm.LinearSVC()
c.fit(np.random.random((10, 2)), np.random.randint(0, 2, size=10))
print c.predict(np.random.random(2))
copy.deepcopy(c).predict(np.random.random(2))

Produces

[1]
Traceback (most recent call last):
  File "<stdin>", line 8, in <module>
  File "/usr/local/lib/python2.7/site-packages/scikit_learn-0.11_git-py2.7-linux-i686.egg/sklearn/svm/base.py", line 764, in predict
    self.label_, self._get_bias())
  File "liblinear.pyx", line 212, in sklearn.svm.liblinear.predict_wrap (sklearn/svm/liblinear.c:3624)
ValueError: ndarray is not Fortran contiguous

Somewhere in the copy the fortran raw_coef_ is made c contiguous.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0