In [1]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [4]:
from sklearn.datasets import load_boston
boston = load_boston()

In [11]:
from sklearn.cross_validation import train_test_split
boston_X_train, boston_X_test, boston_y_train, boston_y_test = train_test_split(boston.data, boston.target)

print(boston_X_train.shape, boston_y_train.shape, boston_X_test.shape, boston_y_test.shape, end='\n')


(379, 13) (379,) (127, 13) (127,)

In [12]:
from sklearn.svm import LinearSVC
boston_clf = LinearSVC().fit(boston_X_train, boston_y_train)

print(boston_clf.score(boston_X_test, boston_y_test))


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-12-d8acd985e900> in <module>()
      2 boston_clf = LinearSVC().fit(boston_X_train, boston_y_train)
      3 
----> 4 print(boston_clf.score(boston_X_test, boston_y_test))

/home/taylor/repos/cryme/venv/lib/python3.4/site-packages/sklearn/base.py in score(self, X, y, sample_weight)
    293         """
    294         from .metrics import accuracy_score
--> 295         return accuracy_score(y, self.predict(X), sample_weight=sample_weight)
    296 
    297 

/home/taylor/repos/cryme/venv/lib/python3.4/site-packages/sklearn/metrics/classification.py in accuracy_score(y_true, y_pred, normalize, sample_weight)
    177 
    178     # Compute accuracy for each possible representation
--> 179     y_type, y_true, y_pred = _check_targets(y_true, y_pred)
    180     if y_type.startswith('multilabel'):
    181         differing_labels = count_nonzero(y_true - y_pred, axis=1)

/home/taylor/repos/cryme/venv/lib/python3.4/site-packages/sklearn/metrics/classification.py in _check_targets(y_true, y_pred)
     90     if (y_type not in ["binary", "multiclass", "multilabel-indicator",
     91                        "multilabel-sequences"]):
---> 92         raise ValueError("{0} is not supported".format(y_type))
     93 
     94     if y_type in ["binary", "multiclass"]:

ValueError: continuous is not supported

In [ ]: