Spaces:
Sleeping
Sleeping
Update app.R
Browse files
app.R
CHANGED
@@ -224,11 +224,15 @@ server <- function(input, output) {
|
|
224 |
# Confusion Matrix
|
225 |
output$confusionMatText <- renderPrint({
|
226 |
|
227 |
-
if (is.null(input$file1))
|
228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
|
230 |
-
inFile <- input$file1
|
231 |
-
dataset <- readr::read_delim(inFile$datapath,delim='\t',progress = FALSE)
|
232 |
predictions <- predict(model, dataset)
|
233 |
cm<-caret::confusionMatrix(reference=as.factor(dataset$Activity),predictions,mode="everything")
|
234 |
cm$overall
|
@@ -236,11 +240,12 @@ server <- function(input, output) {
|
|
236 |
|
237 |
output$confusionMatPlot <- renderPlot({
|
238 |
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
|
|
244 |
predictions <- predict(model, dataset)
|
245 |
cm<-caret::confusionMatrix(reference=as.factor(dataset$Activity),predictions,mode="everything")
|
246 |
|
|
|
224 |
# Confusion Matrix
|
225 |
output$confusionMatText <- renderPrint({
|
226 |
|
227 |
+
file_path <- if (is.null(input$file1)) {
|
228 |
+
default_file_path
|
229 |
+
} else {
|
230 |
+
input$file1$datapath
|
231 |
+
}
|
232 |
+
|
233 |
+
dataset <- readr::read_delim(file_path,delim='\t',progress = FALSE)
|
234 |
+
|
235 |
|
|
|
|
|
236 |
predictions <- predict(model, dataset)
|
237 |
cm<-caret::confusionMatrix(reference=as.factor(dataset$Activity),predictions,mode="everything")
|
238 |
cm$overall
|
|
|
240 |
|
241 |
output$confusionMatPlot <- renderPlot({
|
242 |
|
243 |
+
file_path <- if (is.null(input$file1)) {
|
244 |
+
default_file_path
|
245 |
+
} else {
|
246 |
+
input$file1$datapath
|
247 |
+
}
|
248 |
+
dataset <- readr::read_delim(file_path,delim='\t')
|
249 |
predictions <- predict(model, dataset)
|
250 |
cm<-caret::confusionMatrix(reference=as.factor(dataset$Activity),predictions,mode="everything")
|
251 |
|