machine-learning - 如何使用 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) 。如何使用朴素贝叶斯预测数据?
解决方案
我建议您查看sklearn
Naive Bayes 分类器的文档:这里
推荐阅读
- python - 如何获取列中多个最小值的索引?
- javascript - Jest: How to mock one specific method of an already-mocked class
- pytorch - Pytorch 闪电:“CIFAR10DataModule”对象没有属性“train_loader”
- embedded - Jump to another application
- android - firebase storage how can I save the images in the ram To prevent the image from loading when switching between fragments or activities
- python - Loop Through Pandas Dataframe and split into multiple dataframes based on unique column values
- python - 使用 json 文件中的特定键、值对更新 python 字典
- c - When stack stores data in LIFO
- file-upload - How to sync files programmatically to Azure storage in a way like Dropbox?
- r - Running a Simulation in NLME