私は投稿のタグ付けの問題に取り組んでおり、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}