1- learnitdown :: learnitdownShinyVersion(" 1.0 .0" )
1+ learnitdown :: learnitdownShinyVersion(" 1.1 .0" )
22conf <- BioDataScience :: config()
33
44library(shiny )
55library(learnitdown )
66library(BioDataScience2 )
77
8- a_init <- - 1 .5
9- b_init <- 3 .5
8+ a_init <- 3 .5
9+ b_init <- - 1 .5
1010error_sd <- 0.25
1111set.seed(42 )
1212
1313reglin <- function (x , a , b )
14- ( a * x ) + b
14+ a + ( b * x )
1515
1616model_data <- tibble :: tibble(
1717 x = seq(0 , 10 , by = 0.25 ),
@@ -24,7 +24,7 @@ ui <- fluidPage(
2424 sidebarLayout(
2525 sidebarPanel(
2626 withMathJax(),
27- p(" $$y(x) = a \\ x + \\ b $$" ),
27+ p(" $$y(x) = a \\ + \\ b \\ x $$" ),
2828 sliderInput(" a" , label = " a" ,
2929 value = 0 , min = - 5 , max = 5 , step = 0.5 ),
3030 sliderInput(" b" , label = " b" ,
@@ -61,7 +61,7 @@ server <- function(input, output, session) {
6161
6262 output $ model_equation <- renderUI({
6363 withMathJax(
64- sprintf(" $$y(x) \\ = %.02f \\ x + \\ %.02f$$" ,
64+ sprintf(" $$y(x) \\ = %.02f \\ + \\ %.02f \\ x $$" ,
6565 input $ a , input $ b ))
6666 })
6767
@@ -84,8 +84,8 @@ server <- function(input, output, session) {
8484 sign_in.fun = BioDataScience :: sign_in , conf = conf )
8585 trackSubmit(session , input , output , max_score = 2 ,
8686 solution = list (a = a_init , b = b_init ),
87- comment = " y = a.x + b" ,
88- message.success = " Correct, c'est le meilleur modèle. a est la pente et b est l'ordonnée à l'origine de la droite." ,
87+ comment = " y = a + b.x " ,
88+ message.success = " Correct, c'est le meilleur modèle. a est l'ordonnée à l'origine et b est la pente de la droite." ,
8989 message.error = " Incorrect, un modèle mieux ajusté existe." )
9090 trackQuit(session , input , output , delay = 20 )
9191}
0 commit comments