-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.R
49 lines (41 loc) · 1.12 KB
/
server.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function(input, output, session) {
data <- reactive({
req(input$dataset)
fread(input$dataset$datapath, stringsAsFactors = T)
})
data_NA <- reactive({
as.data.table(unlist(lapply(data(), function(x) sum(is.na(x)))), T)[, V1 := reorder(V1, V2)][]
})
output$plotNA <- renderPlotly({
req(nrow(data_NA()[V2 > 0]) != 0)
plot_ly(data_NA()) %>%
add_bars(x = ~ V2, y = ~ V1) %>%
layout(
xaxis = list(title = 'Number of observations'),
yaxis = list(title = ''),
title = "Number of NA's"
)
})
output$datatable <- renderDT({
data()
})
observe({
shiny::updateSelectInput(session, "response", choices = names(data()))
shiny::updateSelectInput(session, "independent", choices = names(data()))
})
h2o_data <- reactive(as.h2o(data()))
leaderboard <- eventReactive(input$automl, {
withProgress(
message = "Running AutoML",
h2o.automl(
input$independent,
input$response,
h2o_data(),
max_runtime_secs = input$seconds
)
)
})
output$leaderboard <- renderPrint({
leaderboard()@leaderboard
})
}