ValueError: setting an array element with a sequence. > 373 array = np.array(array, dtype=dtype, order=order, copy=copy) Library/Frameworks/amework/Versions/3.5/lib/python3.5/site-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator) > 150 X = check_array(X, accept_sparse='csr', dtype=np.float64, order='C') Library/Frameworks/amework/Versions/3.5/lib/python3.5/site-packages/sklearn/svm/base.py in fit(self, X, y, sample_weight)ġ48 self._sparse = sparse and not callable(self.kernel) Note: The number of elements in each dimension of an array is known as its shape. library, and the NumPy array is not in sequence. > 10 classifier.fit(,())ġ2 #classifier.fit(t, list(range(0,2899))) 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. If we stop using the ‘int’ keyword, things gonna little change. The problem is to say that this is an integer array. It means every single element of this array needs to be an integer. We are saying that this is an integer array. trainingImages = images.ix[images.partID in () What it tells is simple: An integer array element can’t be a list. I always get this error "ValueError: setting an array element with a sequence". I pass to the fit function a numpy array that has 2D lists, these 2D lists represents images and the second input I pass to the function is the list of targets (The targets are numbers). Then as we need to tokenized our data to feed it into the embedding. The dataset is twitter dataset, as it can contain mainly un-processed tweets, so I first processed the data, by cleaning the punctuations and un-used words or not-meaningful words. I am using sklearn to apply svm on my own set of images. Guys, I am making a Sentiment Analysis Classifier and now I am stuck with a problem called ValueError: setting an array element with a sequence.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |