r - run caret method without parameters -
i'm trying run caret method not requires parameters, such lda, example below uses "lvq" needs 2 parameters (size , k)
set.seed(7) # load library library(caret) # load dataset data(iris) # prepare training scheme control <- traincontrol(method="repeatedcv", number=10, repeats=3) # design parameter tuning grid grid <- expand.grid(size=c(5,10,20,50), k=c(1,2,3,4,5)) # train model model <- train(species~., data=iris, method="lvq", trcontrol=control, tunegrid=grid) # summarize model print(model) plot(model)
i tried work out assigning tunegrid=null
set.seed(7) # load library library(caret) # load dataset data(iris) # prepare training scheme control <- traincontrol(method="repeatedcv", number=10, repeats=3) # design parameter tuning grid grid <- expand.grid(size=c(5,10,20,50), k=c(1,2,3,4,5)) # train model model <- train(species~., data=iris, method="lda", trcontrol=control, tunegrid=null) # summarize model print(model) plot(model)
but error
there no tuning parameters model
i'll answer own question, think deleting tunegrid=null
works fine
set.seed(7) # load library library(caret) # load dataset data(iris) # prepare training scheme control <- traincontrol(method="repeatedcv", number=10, repeats=3) # design parameter tuning grid grid <- expand.grid(size=c(5,10,20,50), k=c(1,2,3,4,5)) # train model model <- train(species~., data=iris, method="lda", trcontrol=control) # summarize model print(model)
Comments
Post a Comment