Converting to a numpy array gave me a different and strange error message:
/Users/andrewwinterman/Documents/sparks-honey/classifier/lib/python2.7/site-packages/sklearn/grid_search.pyc
in fit_grid_point(X, y, base_clf, clf_params, train, test, loss_func,
score_func, verbose, **fit_params)
109 y_test = y[safe_mask(y, test)]
110 y_train = y[safe_mask(y, train)]
--> 111 clf.fit(X_train, y_train, **fit_params)
112 if loss_func is not None:
113 y_pred = clf.predict(X_test)
/Users/andrewwinterman/Documents/sparks-honey/classifier/lib/python2.7/site-packages/sklearn/multiclass.pyc
in fit(self, X, y)
183 self
184 """
--> 185 self.estimators_, self.label_binarizer_ =
fit_ovr(self.estimator, X, y)
186 return self
187
/Users/andrewwinterman/Documents/sparks-honey/classifier/lib/python2.7/site-packages/sklearn/multiclass.pyc
in fit_ovr(estimator, X, y)
79
80 lb = LabelBinarizer()
---> 81 Y = lb.fit_transform(y)
82 estimators = [_fit_binary(estimator, X, Y[:, i],
83 classes=["not %s" % str(i), i])
/Users/andrewwinterman/Documents/sparks-honey/classifier/lib/python2.7/site-packages/sklearn/base.pyc
in fit_transform(self, X, y, **fit_params)
350 if y is None:
351 # fit method of arity 1 (unsupervised transformation)
--> 352 return self.fit(X, **fit_params).transform(X)
353 else:
354 # fit method of arity 2 (supervised transformation)
/Users/andrewwinterman/Documents/sparks-honey/classifier/lib/python2.7/site-packages/sklearn/preprocessing.pyc
in fit(self, y)
955 self.classes_ = np.array(sorted(set.union(*map(set,
y))))
956 else:
--> 957 self.classes_ = np.unique(y)
958 return self
959
/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/arraysetops.pyc
in unique(ar, return_index, return_inverse)
192
193 else:
--> 194 ar.sort()
195 flag = np.concatenate(([True], ar[1:] != ar[:-1]))
196 return ar[flag]
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()
Should I open an issue on github?
On Tue, Jan 8, 2013 at 3:54 PM, Andrew Winterman <[email protected]>wrote:
> X is a sparse matrix:
>
> >>>> X
> <926x1238 sparse matrix of type '<type 'numpy.float64'>'
> with 43973 stored elements in Compressed Sparse Row format>
>
> Y is a regular python list of 926 lists of strings:
>
> >>>> Y[0:10]
> [['29'], ['3',
> '24'], ['48'], ['29'], ['37'], ['3'], ['14'], ['21'], ['16', '48',
> '50'], ['48']]
>
>
>
> On Tue, Jan 8, 2013 at 3:43 PM, Andreas Mueller
> <[email protected]>wrote:
>
>> What is the type and shape of Y and X?
>>
>
>
>
> --
> Andrew Winterman
> 714 362 6823
>
--
Andrew Winterman
714 362 6823
------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general