1

我正在研究一个 pos 标记问题并使用 LogisticRegressionCV 模型来解决它。我提取了单词的特征并用DictVectorizer(). 但是,在模型拟合时出现错误。部分后model.fit,控制台给出警告和错误:

 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)

代码

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}
4

0 回答 0