Spaces:
Starting
Starting
Update app.R
Browse files
app.R
CHANGED
|
@@ -43,10 +43,10 @@ ui <- fluidPage(
|
|
| 43 |
tabPanel("About",
|
| 44 |
HTML("
|
| 45 |
<h5> The following model was part of the the research article: </h5>
|
|
|
|
| 46 |
|
| 47 |
<p><p> <h5> You can test the app using an example dataset available <a href='https://github.com/harpomaxx/goat-behavior-model/blob/881ed7251a58a55b05d5eb3a3bc40225ba6694cb/data/split/dataset_a.tsv' > here </a></h5>
|
| 48 |
-
|
| 49 |
-
<h4>Developing an Interpretable Machine Learning Model for the Detection of Mimosa Grazing in Goats</h4>
|
| 50 |
|
| 51 |
<em>In the last years, several machine learning approaches for detecting animal behaviors have been proposed.
|
| 52 |
However, despite their successful application, their complexity and lack of explainability have difficulty in their
|
|
@@ -263,11 +263,13 @@ server <- function(input, output) {
|
|
| 263 |
|
| 264 |
output$SHAPSummary <- renderPlot({
|
| 265 |
|
| 266 |
-
if (is.null(input$file1))
|
| 267 |
-
|
|
|
|
|
|
|
|
|
|
| 268 |
|
| 269 |
-
|
| 270 |
-
dataset <- readr::read_delim(inFile$datapath,delim='\t')
|
| 271 |
predictions <- predict(model, dataset)
|
| 272 |
selected_variables <-
|
| 273 |
readr::read_delim(
|
|
@@ -286,11 +288,13 @@ server <- function(input, output) {
|
|
| 286 |
|
| 287 |
output$SHAPSummaryperclass <- renderPlot({
|
| 288 |
|
| 289 |
-
if (is.null(input$file1))
|
| 290 |
-
|
|
|
|
|
|
|
|
|
|
| 291 |
|
| 292 |
-
|
| 293 |
-
dataset <- readr::read_delim(inFile$datapath,delim='\t')
|
| 294 |
predictions <- predict(model, dataset)
|
| 295 |
selected_variables <-
|
| 296 |
readr::read_delim(
|
|
@@ -316,11 +320,12 @@ server <- function(input, output) {
|
|
| 316 |
})
|
| 317 |
output$SHAPDependency <- renderPlot({
|
| 318 |
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
|
|
|
| 324 |
predictions <- predict(model, dataset)
|
| 325 |
selected_variables <-
|
| 326 |
readr::read_delim(
|
|
|
|
| 43 |
tabPanel("About",
|
| 44 |
HTML("
|
| 45 |
<h5> The following model was part of the the research article: </h5>
|
| 46 |
+
<h4>Developing an Interpretable Machine Learning Model for the Detection of Mimosa Grazing in Goats</h4>
|
| 47 |
|
| 48 |
<p><p> <h5> You can test the app using an example dataset available <a href='https://github.com/harpomaxx/goat-behavior-model/blob/881ed7251a58a55b05d5eb3a3bc40225ba6694cb/data/split/dataset_a.tsv' > here </a></h5>
|
| 49 |
+
<p><p> <h5> A dataset is already preloaded in the app for demostration purposes </a></h5>
|
|
|
|
| 50 |
|
| 51 |
<em>In the last years, several machine learning approaches for detecting animal behaviors have been proposed.
|
| 52 |
However, despite their successful application, their complexity and lack of explainability have difficulty in their
|
|
|
|
| 263 |
|
| 264 |
output$SHAPSummary <- renderPlot({
|
| 265 |
|
| 266 |
+
file_path <- if (is.null(input$file1)) {
|
| 267 |
+
default_file_path
|
| 268 |
+
} else {
|
| 269 |
+
input$file1$datapath
|
| 270 |
+
}
|
| 271 |
|
| 272 |
+
dataset <- readr::read_delim(file_path,delim='\t')
|
|
|
|
| 273 |
predictions <- predict(model, dataset)
|
| 274 |
selected_variables <-
|
| 275 |
readr::read_delim(
|
|
|
|
| 288 |
|
| 289 |
output$SHAPSummaryperclass <- renderPlot({
|
| 290 |
|
| 291 |
+
file_path <- if (is.null(input$file1)) {
|
| 292 |
+
default_file_path
|
| 293 |
+
} else {
|
| 294 |
+
input$file1$datapath
|
| 295 |
+
}
|
| 296 |
|
| 297 |
+
dataset <- readr::read_delim(file_path,delim='\t')
|
|
|
|
| 298 |
predictions <- predict(model, dataset)
|
| 299 |
selected_variables <-
|
| 300 |
readr::read_delim(
|
|
|
|
| 320 |
})
|
| 321 |
output$SHAPDependency <- renderPlot({
|
| 322 |
|
| 323 |
+
file_path <- if (is.null(input$file1)) {
|
| 324 |
+
default_file_path
|
| 325 |
+
} else {
|
| 326 |
+
input$file1$datapath
|
| 327 |
+
}
|
| 328 |
+
dataset <- readr::read_delim(file_path,delim='\t')
|
| 329 |
predictions <- predict(model, dataset)
|
| 330 |
selected_variables <-
|
| 331 |
readr::read_delim(
|