Spaces:
Running
Running
Update app.R
Browse files
app.R
CHANGED
|
@@ -317,6 +317,7 @@ server <- function(input, output, session) {
|
|
| 317 |
label <- paste("Case=Adversarial, Lambda=", my_lambda, sep="")
|
| 318 |
}
|
| 319 |
|
|
|
|
| 320 |
if (input$case_type == "Average") {
|
| 321 |
# Subset data for Average case
|
| 322 |
if (input$respondent_group == "All") {
|
|
@@ -363,7 +364,8 @@ server <- function(input, output, session) {
|
|
| 363 |
conda_env_required = params$conda_env_required
|
| 364 |
)
|
| 365 |
Qoptimized$n_strategies <- 1L
|
| 366 |
-
}
|
|
|
|
| 367 |
# Adversarial case
|
| 368 |
|
| 369 |
DROP_FACTORS <- c("Office", "Party.affiliation", "Party.competition")
|
|
@@ -457,12 +459,16 @@ server <- function(input, output, session) {
|
|
| 457 |
# plot(unlist(Qoptimized$pi_star_point$Democrat), unlist(Qoptimized$pi_star_point$Republican))
|
| 458 |
Qoptimized$n_strategies <- 2L
|
| 459 |
}
|
|
|
|
|
|
|
|
|
|
| 460 |
|
| 461 |
Qoptimized <- Qoptimized[c("pi_star_point",
|
| 462 |
"pi_star_se",
|
| 463 |
"Q_point",
|
| 464 |
"Q_se",
|
| 465 |
-
"n_strategies"
|
|
|
|
| 466 |
|
| 467 |
incProgress(0.8, detail = "Finalizing results...")
|
| 468 |
|
|
@@ -506,7 +512,9 @@ server <- function(input, output, session) {
|
|
| 506 |
if(show_se){ show_se <- q_se > 0 }
|
| 507 |
if(!show_se){ render_text <- paste("Estimated Q Value:", sprintf("%.3f", q_point)) }
|
| 508 |
if(show_se){ render_text <- paste("Estimated Q Value:", sprintf("%.3f ± %.3f", q_point, 1.96 * q_se)) }
|
| 509 |
-
|
|
|
|
|
|
|
| 510 |
})
|
| 511 |
|
| 512 |
# Show which set of parameters (label) is currently selected
|
|
|
|
| 317 |
label <- paste("Case=Adversarial, Lambda=", my_lambda, sep="")
|
| 318 |
}
|
| 319 |
|
| 320 |
+
strategize_start <- Sys.time() # Timing strategize start
|
| 321 |
if (input$case_type == "Average") {
|
| 322 |
# Subset data for Average case
|
| 323 |
if (input$respondent_group == "All") {
|
|
|
|
| 364 |
conda_env_required = params$conda_env_required
|
| 365 |
)
|
| 366 |
Qoptimized$n_strategies <- 1L
|
| 367 |
+
}
|
| 368 |
+
if (input$case_type == "Adversarial"){
|
| 369 |
# Adversarial case
|
| 370 |
|
| 371 |
DROP_FACTORS <- c("Office", "Party.affiliation", "Party.competition")
|
|
|
|
| 459 |
# plot(unlist(Qoptimized$pi_star_point$Democrat), unlist(Qoptimized$pi_star_point$Republican))
|
| 460 |
Qoptimized$n_strategies <- 2L
|
| 461 |
}
|
| 462 |
+
Qoptimized$runtime_seconds <- as.numeric(difftime(Sys.time(),
|
| 463 |
+
strategize_start,
|
| 464 |
+
units = "secs"))
|
| 465 |
|
| 466 |
Qoptimized <- Qoptimized[c("pi_star_point",
|
| 467 |
"pi_star_se",
|
| 468 |
"Q_point",
|
| 469 |
"Q_se",
|
| 470 |
+
"n_strategies",
|
| 471 |
+
"runtime_seconds")]
|
| 472 |
|
| 473 |
incProgress(0.8, detail = "Finalizing results...")
|
| 474 |
|
|
|
|
| 512 |
if(show_se){ show_se <- q_se > 0 }
|
| 513 |
if(!show_se){ render_text <- paste("Estimated Q Value:", sprintf("%.3f", q_point)) }
|
| 514 |
if(show_se){ render_text <- paste("Estimated Q Value:", sprintf("%.3f ± %.3f", q_point, 1.96 * q_se)) }
|
| 515 |
+
sprintf("%s (Runtime: %.3f s)",
|
| 516 |
+
render_text,
|
| 517 |
+
selectedResult()$runtime_seconds)
|
| 518 |
})
|
| 519 |
|
| 520 |
# Show which set of parameters (label) is currently selected
|