Hi

I am trying to run through

scikit-learn.github.com/scikit-learn-tutorial/working_with_text_data.html
as is.

Calls to SGDClassifier(...).fit(...), either within the pipe or directly,
invoke
       "ValueError: setting an array element with a sequence."

Thanks much (great tool!!!)

-----------------------------------------------------------------
ValueErrorTraceback (most recent call last)
<ipython-input-106-ef6823203ba9> in <module>()
 12 sgd = SGDClassifier(loss='hinge', penalty='l2', alpha=1e-3,
n_iter=5) 13text_clf
= Pipeline([('vect', CountVectorizer()), ('tfidf', TfidfTransformer()), (
'clf', sgd), ]) ---> 14 _ = text_clf.fit(twenty_train.data, twenty_train.
target) /usr/lib/pymodules/python2.7/sklearn/pipeline.pyc in fit(self, X,
y, **fit_params) 127 """ 128 Xt, fit_params = self._pre_transform(X, y, **
fit_params) --> 129 self.steps[-1][-1].fit(Xt, y, **fit_params) 130 returnself
131 /usr/lib/pymodules/python2.7/sklearn/linear_model/base.pyc in fit(self,
X, y, coef_init, intercept_init, class_weight, sample_weight) 426 #
delegate to concrete training procedure 427 if n_classes > 2: --> 428 self.
_fit_multiclass(X, y, sample_weight) 429 elif n_classes == 2: 430 self.
_fit_binary(X, y, sample_weight)
/usr/lib/pymodules/python2.7/sklearn/linear_model/stochastic_gradient.pycin
_fit_multiclass(self, X, y, sample_weight) 162 strategy is called OVA: One
Versus All. 163 """ --> 164 X = np.asarray(X, dtype=np.float64, order='C')
165  166 # Use joblib to run OVA in parallel.
/usr/lib/python2.7/dist-packages/numpy/core/numeric.pyc in asarray(a,
dtype, order) 233  234 """ --> 235 return array(a, dtype, copy=False, order=
order) 236  237 def asanyarray(a, dtype=None, order=None): ValueError:
setting an array element with a sequence.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to