我正在做一个朴素贝叶斯分类,使用多项式NB拟合方法,并向其传递两个变量,即熊猫系列,如何将熊猫系列转换为sklearn多项式NB需要的适当类型
这是我的python代码:
x = ConcatenateWordsSentiments['text']
y = ConcatenateWordsSentiments['label']
from sklearn.model_selection import train_test_split
#split train / test
X_train, X_test, y_train, y_test = train_test_split(xtrain, ytrain,
test_size=0.33, random_state=42)
from sklearn.naive_bayes import MultinomialNB
nb = MultinomialNB()
nb.fit(X_train, y_train)
这里的x,y,x_火车和y_火车是熊猫系列
目前没有回答
相关问题 更多 >
编程相关推荐