Self.tfidf = models.TfidfModel(dictionary=self. First tokenizing text, then converting it to bow by: bow_text = 2bow(tokenized_text) Vectorized_data is obtained using gensim framework. I am trying to use sklearn regression within my cost function, but that seems to. When I try pip freeze than on both machines it looks exactly the same.ĭoes anyone has some idea what can be possibly wrong? ValueError: setting an array element with a sequence. I'd like to run the training on the Ubuntu machine to be able to run it in screen. ValueError: setting an array element with a sequence. > 344 array = np.array(array, dtype=dtype, order=order, copy=copy)ģ45 # make sure we actually converted to numeric:ģ46 if dtype_numeric and = "O": home/ubuntu/.virtualenvs/topics/local/lib/python2.7/site-packages/sklearn/utils/validation.pyc in check_array(array, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features) home/ubuntu/.virtualenvs/topics/local/lib/python2.7/site-packages/sklearn/utils/validation.pyc in check_X_y(X, y, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, multi_output, ensure_min_samples, ensure_min_features, y_numeric)Ĥ42 X = check_array(X, accept_sparse, dtype, order, copy, force_all_finite,Ĥ43 ensure_2d, allow_nd, ensure_min_samples,Ĥ46 y = check_array(y, 'csr', force_all_finite=True, ensure_2d=False, home/ubuntu/.virtualenvs/topics/local/lib/python2.7/site-packages/sklearn/naive_bayes.pyc in fit(self, X, y, sample_weight) Understanding scikit-learn 'ValueError: setting an array element with a sequence' due to data shape : r/MLQuestions. Note: The number of elements in each dimension of an array is known as its shape. I'm guessing it's because the utmterm part of the array is irregular but can't work out how to resolve it - any pointers greatly appreciated. library, and the NumPy array is not in sequence. This gives me an error: ValueError: setting an array element with a sequence. home/ubuntu/topic_modeling/classification.pyc in train_models(self, vectorizer, data)ĩ2 # TODO some more complex grid search should be here The ValueError: setting an array element with a sequence occurs when: An array does not have a proper shape, i.e., a multidimensional array has improper dimensions at different levels. > 135 bm.train_models(self.vectorizer, self.data)ġ37 ("Successfully trained model for the %s tag", label) home/ubuntu/topic_modeling/classification.pyc in train_models(self, minimal) On my macbook model training goes well, but on the Ubuntu machine I am getting: in () machine learning - Getting 'ValueError: setting an array element with a sequence.' when attempting to fit mixed-type data - Data Science Stack Exchange Getting 'ValueError: setting an array element with a sequence. My code looks just like this (It uses MultinomialNB() from scikit learn): clf = MultinomialNB() I am trying to run exactly the same code, once at my macbook pro and once at Ubuntu machine at AWS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |