在 R 中使用插入符号调整朴素贝叶斯分类器
Posted
技术标签:
【中文标题】在 R 中使用插入符号调整朴素贝叶斯分类器【英文标题】:tuning naive Bayes classifier with Caret in R 【发布时间】:2017-07-04 01:40:00 【问题描述】:我用以下代码训练模型,但是,我不知道如何更改 tunegrid,因为 FL 和 Adjust 一直保持在特定值。(我的数据集是分类的)
Activity_nb <- train(Actx, Acty,data = Dact, method = "nb", trControl = myc1,metric = "Accuracy",importance = TRUE)
Naive Bayes
2694 samples
4 predictor
4 classes: 'CC', 'CE', 'CW', 'HA'
No pre-processing
Resampling: Cross-Validated (10 fold)
Summary of sample sizes: 2425, 2424, 2426, 2425, 2425, 2423, ...
Resampling results across tuning parameters:
usekernel Accuracy Kappa
FALSE 0.8165804 0.6702313
TRUE 0.8165804 0.6702313
Tuning parameter 'fL' was held constant at a value of 0
Tuning parameter 'adjust' was held constant at a value of 1
Accuracy was used to select the optimal model using the largest value.
The final values used for the model were fL = 0, usekernel = FALSE and adjust = 1.
【问题讨论】:
【参考方案1】:grid <- data.frame(fL=c(0,0.5,1.0), usekernel = TRUE, adjust=c(0,0.5,1.0))
Activity_nb <- train(..., tuneGrid=grid, ...)
希望这会有所帮助。
【讨论】:
请解释一下以上是关于在 R 中使用插入符号调整朴素贝叶斯分类器的主要内容,如果未能解决你的问题,请参考以下文章