I'm working on a pos tagging problem and using LogisticRegressionCV model to solve it. I extracted features of words and vectorized them with DictVectorizer()
. However, I'm getting an error while model is fitting. After model.fit
part, the console gives warning and error:
UserWarning: The least populated class in y has 1 members, which is less than n_splits=5.
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of
lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated.
ValueError: could not broadcast input array from shape (10,25,828) into shape (10)
Code
self.vectorizer = DictVectorizer()
self.model = LogisticRegressionCV(max_iter = 500)
vectorized_features = self.vectorizer.fit_transform(self.features) #vectorized_features shape{tuple:2}(193, 827)
self.model.fit(vectorized_features, self.pos_labels) #pos_labels {list:193}