使用朴素贝叶斯MultinomialNB时遇到的RuntimeWarning被零除

时间:2019-05-14 09:46:36

标签: python text-classification naivebayes countvectorizer

我正在使用sklearn进行文本分类,我有以下管道:

from sklearn.pipeline import Pipeline
from sklearn.naive_bayes import MultinomialNB
text_clf = Pipeline([
    ('vect', CountVectorizer()),
    ('clf', MultinomialNB())])

text_clf.fit(X_train, y_train)

然后出现此错误:

Anaconda3\lib\site-packages\sklearn\naive_bayes.py:465: RuntimeWarning: divide by zero encountered in log
  self.class_log_prior_ = (np.log(self.class_count_) -

0 个答案:

没有答案