Created
September 2, 2012 13:52
-
-
Save amueller/3599098 to your computer and use it in GitHub Desktop.
sparse svm error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy import sparse | |
from sklearn import svm | |
from nose.tools import assert_raises | |
X = np.array([[-2, -1], [-1, -1], [-1, -2], [1, 1], [1, 2], [2, 1]]) | |
X_sp = sparse.lil_matrix(X) | |
Y = [1, 1, 1, 2, 2, 2] | |
sp = svm.sparse.SVC(C=1, kernel=lambda x, y: x * y.T, probability=True) | |
assert_raises(ValueError, sp.fit, X_sp, Y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment