Skip to content

Instantly share code, notes, and snippets.

/error

Created Oct 6, 2014
Embed
What would you like to do?
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-229-0c627bda0543> in <module>()
5 }
6 gs = GridSearchCV(clf_SVM, params, cv=5, scoring='roc_auc')
----> 7 gs.fit(corpus1, y)
/usr/local/lib/python2.7/dist-packages/sklearn/grid_search.pyc in fit(self, X, y)
594
595 """
--> 596 return self._fit(X, y, ParameterGrid(self.param_grid))
597
598
/usr/local/lib/python2.7/dist-packages/sklearn/grid_search.pyc in _fit(self, X, y, parameter_iterable)
376 train, test, self.verbose, parameters,
377 self.fit_params, return_parameters=True)
--> 378 for parameters in parameter_iterable
379 for train, test in cv)
380
/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/parallel.pyc in __call__(self, iterable)
651 self._iterating = True
652 for function, args, kwargs in iterable:
--> 653 self.dispatch(function, args, kwargs)
654
655 if pre_dispatch == "all" or n_jobs == 1:
/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/parallel.pyc in dispatch(self, func, args, kwargs)
398 """
399 if self._pool is None:
--> 400 job = ImmediateApply(func, args, kwargs)
401 index = len(self._jobs)
402 if not _verbosity_filter(index, self.verbose):
/usr/local/lib/python2.7/dist-packages/sklearn/externals/joblib/parallel.pyc in __init__(self, func, args, kwargs)
136 # Don't delay the application, to avoid keeping the input
137 # arguments in memory
--> 138 self.results = func(*args, **kwargs)
139
140 def get(self):
/usr/local/lib/python2.7/dist-packages/sklearn/cross_validation.pyc in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters)
1237 estimator.fit(X_train, **fit_params)
1238 else:
-> 1239 estimator.fit(X_train, y_train, **fit_params)
1240 test_score = _score(estimator, X_test, y_test, scorer)
1241 if return_train_score:
/usr/local/lib/python2.7/dist-packages/sklearn/svm/base.pyc in fit(self, X, y)
672 """
673 self._enc = LabelEncoder()
--> 674 y_ind = self._enc.fit_transform(y)
675 if len(self.classes_) < 2:
676 raise ValueError("The number of classes has to be greater than"
/usr/local/lib/python2.7/dist-packages/sklearn/preprocessing/label.pyc in fit_transform(self, y)
123 y : array-like of shape [n_samples]
124 """
--> 125 y = column_or_1d(y, warn=True)
126 _check_numpy_unicode_bug(y)
127 self.classes_, y = np.unique(y, return_inverse=True)
/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.pyc in column_or_1d(y, warn)
317 return np.ravel(y)
318
--> 319 raise ValueError("bad input shape {0}".format(shape))
320
321
ValueError: bad input shape (1380, 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment