【发布时间】:2020-01-21 20:27:51
【问题描述】:
使用朴素贝叶斯算法
from sklearn.naive_bayes import MultinomialNB
nb = MultinomialNB()
代码一直工作到这一行,但是当我拟合模型时,它会显示错误。
nb.fit(X_train, y_train)
输出:
ValueError: could not convert string to float: 'My fiance and
I tried the place because of a Groupon. We live in the same neighborhood
and see the place all the time but the look of the place was never enough
to draw us in. There is nothing eye catching about the business front at
all. It\'s in a strip mall and looks old..........
我正在使用 yelp.csv 数据集进行自然语言处理
预期的答案应该是这样的
MultinomialNB(alpha=1.0, class_prior=None, fit_prior=True)
【问题讨论】:
标签: python machine-learning nlp training-data countvectorizer