2

我正在使用 R caret 包,我想将离散化函数应用于交叉验证中的所有预测变量。

例如使用此代码:

# load the library
library(caret)
# load the iris dataset
data(iris)
# define training control
train_control <- trainControl(method="cv", number=10)
# fix the parameters of the algorithm
grid <- expand.grid(.fL=c(0), .usekernel=c(FALSE))
# train the model
model <- train(Species~., data=iris, trControl=train_control, method="nb", tuneGrid=grid)
# summarize results
print(model)

我想仅使用训练折叠discretizeDF.supervised来学习正确的组,然后将其应用于测试折叠. 只要有监督,我不介意使用任何其他库/函数进行离散化。

AFAIK这是进行离散化的正确方法,因此它必须是一种方法。我一直在阅读有关“食谱”的信息,但我无法让它发挥作用。

4

0 回答 0