I'm using R caret package and I want to apply a discretization function to all predictive variables within cross-validation.
For example using this code:
# 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)
I want to apply arules discretizeDF.supervised
(https://www.rdocumentation.org/packages/arulesCBA/versions/1.1.4/topics/discretizeDF.supervised) using only the training fold to learn the correct groups and then apply it to the test fold. I don't mind using any other library/function for discretization as long as it is supervised.
AFAIK this is the correct way to do discretization so it must be a way to do it. I have been reading about "recipes" but I haven't been able to make it work.