首页 > 解决方案 > 如何使用 NaiveBayes 预测数据集

问题描述

x=dataset1[:,1:23] # features
y=dataset1[:,0] #classtypes 
xtrain, xtest, ytrain, ytest = train_test_split(x, y, test_size=0.20)

我的数据集只有字母。1 行有 23 个字母。第一个字母是classtype,其他字母是feauters。我有 2 节课 --> a,z

示例:a,b,c,d,e,...,g

我将计算召回率、精度和其他值,但首先。我需要找到 ypred 导致这些值询问 2 个参数(ytest,ypred) 。如何使用朴素贝叶斯预测数据?

标签: machine-learningnltkpredictnaivebayes

解决方案


我建议您查看sklearnNaive Bayes 分类器的文档:这里


推荐阅读