简体   繁体   English

在R中运行预测功能时下标超出边界错误

[英]Subscript out of Bound error when running predict function in R

I am working on a text mining project using to classify test using Naive Bayes. 我正在一个文本挖掘项目中使用Naive Bayes对测试进行分类。

When I build a Naive Bayes classifier using 当我使用构建朴素贝叶斯分类器时

classifier<-naiveBayes(training, type)

then run the predict function on test data: 然后对测试数据运行预测函数:

pred <- predict(classifier, test)

I get: 我得到:

Error in object$tables[[v]][, nd] : subscript out of bounds

What would be the cause of this error? 该错误的原因是什么?

The training and testing data was a Matrix of Characters. 训练和测试数据是字符矩阵。 When I converted into Numeric, I never faced this problem again. 当我转换为数字时,我再也没有遇到过这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 下标超出随机误差的随机森林预测函数 - Subscript out of bound error in predict function of randomforest 如何克服R中的这种“下标超出范围”错误? - how to overcome this “subscript out of bound” error in R? R - 抓取 - rvest 错误:下标越界 - R - Scraping - rvest error : Subscript out of bound R 和 XML:“下标越界”错误 - R and XML: 'Subscript out of bound' error `[.default`(data, , pos): subscript out of bounds using predict function in R - Error in `[.default`(data, , pos) : subscript out of bounds using predict function in R 如何解决 predict() 中的错误:进行二元分类时 R 中的下标越界? - How to solve Error in predict() : subscript out of bounds in R when doing binary classification? R细分回归预测带来错误:“下标超出范围” - R segmented regression predict gives error: “subscript out of bounds” 在R中使用h2o.confusionMatrix函数时出现错误“下标超出范围” - I have an error “ subscript out of bound ” while using h2o.confusionMatrix function in R betategarch程序包中的预测函数使错误下标超出范围 - predict function in betategarch package gives error subscript out of bounds R:函数上的“下标超出范围”错误 - R: “Subscript out of bounds” error on function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM