R shiny caret how to execute resamples func with list (method types) uploaded from inputCheckboxGrou

8 views
Skip to first unread message

Karol Dziasek

unread,
Aug 23, 2017, 10:39:04 AM8/23/17
to Shiny - Web Framework for R

I have to ask for help. I am trying to send a list of chooses values from inputCheckboxGroup to resamples function. How to make it correcty? Below my part of the code (server.R):

"
......
class_algorithms
<- list("Gradient bootstrap (gbm)" = 'fit.gbm()', "Logistic (glm)" = 'fit.glm()', "Random forest (rf)" = 'fit.rf()' ) output$show.algo.types <- renderUI({ switch(input$class_type, "classification" = checkboxGroupInput('show.algo.types', 'Select Algorithms', class_algorithms, selected = class_algorithms)) }) control <- trainControl(method="repeatedcv", number=2, repeats=2) seed <- 7 metric <- "Accuracy" observeEvent( input$compare_models, ({ models_results <- reactive({ fit.gbm <- reactive({train(Chevy~., data=cars, method="gbm", trControl=control, verbose=FALSE)}) fit.glm <- reactive({train(Chevy~., data=cars, method="glm",trControl=control)}) fit.rf <- reactive({train(Chevy~., data=cars, method="rf",trControl=control)}) algo_choose_list <- paste0(input$show.algo.types, collapse = ", ") results <- resamples(list(**input$show.algo.types**)) return(results) }) output$show.algo.results <- renderPrint({ summary(models_results()) })
....
"
Reply all
Reply to author
Forward
0 new messages