[英]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.