Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRunning model studio in a shiny app #77
Comments
|
I think it would be a great feature to support You can install the new version using install.packages('devtools')
devtools::install_github('ModelOriented/modelStudio', ref='ms-shiny')and try it out - feedback appreciated, as I can expand this feature further. Consider the following example: library(shiny)
library(r2d3)
ui <- fluidPage(
textInput("text", h3("Text input"),
value = "Enter text..."),
uiOutput('dashboard')
)
server <- function(input, output) {
#:# id of div where modelStudio will appear
WIDGET_ID = 'MODELSTUDIO'
#:# create modelStudio
library(modelStudio)
library(DALEX)
model <- glm(survived ~., data = titanic_imputed, family = "binomial")
explainer <- explain(model,
data = titanic_imputed,
y = titanic_imputed$survived,
label = "Titanic GLM",
verbose = FALSE)
ms <- modelStudio(explainer,
widget_id = WIDGET_ID, #:# use the widget_id
show_info = FALSE)
ms$elementId <- NULL #:# remove elementId to stop the warning
#:# basic render d3 output
output[[WIDGET_ID]] <- renderD3({
ms
})
#:# use render ui to set proper width and height
output$dashboard <- renderUI({
d3Output(WIDGET_ID, width=ms$width, height=ms$height)
})
}
shinyApp(ui = ui, server = server) |
|
The example is now added to the vignette https://modelstudio.drwhy.ai/articles/ms-perks-features.html#shiny-1 |
I would like to include the model output inside an existing shiny app (or as a standalone app). Is there any existing code or wrappers for this?