Skip to content

Commit b1fb010

Browse files
committed
CSS added for better printing of learnrs
1 parent b12bcde commit b1fb010

File tree

14 files changed

+204
-30
lines changed

14 files changed

+204
-30
lines changed

inst/tutorials/C00La_refresh/C00La_refresh.Rmd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,3 +791,15 @@ question_text(
791791
allow_retry = TRUE
792792
)
793793
```
794+
795+
```{css, echo=FALSE}
796+
@media print {
797+
.topics {
798+
width: 100% !important;
799+
padding: 0 0.5em 0 !important;
800+
}
801+
.topicsContainer, .topicsContainer *, .learnrBanner, .learnrBanner *, .topicActions, .topicActions * {
802+
display: none !important;
803+
}
804+
}
805+
```

inst/tutorials/C01La_confusion/C01La_confusion.Rmd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,15 @@ question_text(
315315
try_again_button = "Resoumettre une réponse"
316316
)
317317
```
318+
319+
```{css, echo=FALSE}
320+
@media print {
321+
.topics {
322+
width: 100% !important;
323+
padding: 0 0.5em 0 !important;
324+
}
325+
.topicsContainer, .topicsContainer *, .learnrBanner, .learnrBanner *, .topicActions, .topicActions * {
326+
display: none !important;
327+
}
328+
}
329+
```

inst/tutorials/C01Lb_ml1/C01Lb_ml1.Rmd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,15 @@ question_text(
308308
allow_retry = TRUE
309309
)
310310
```
311+
312+
```{css, echo=FALSE}
313+
@media print {
314+
.topics {
315+
width: 100% !important;
316+
padding: 0 0.5em 0 !important;
317+
}
318+
.topicsContainer, .topicsContainer *, .learnrBanner, .learnrBanner *, .topicActions, .topicActions * {
319+
display: none !important;
320+
}
321+
}
322+
```

inst/tutorials/C02La_cv/C02La_cv.Rmd.inactivated

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ grade_code("Si vous souhaitez utiliser la validation croisée pour le test, vous
188188
Évaluez les performances du premier classifieur `rice_lda` sans validation croisée. Pour rappel, les jeux de données disponibles sont les suivants : `rice`, `rice_train` et `rice_test`
189189

190190
```{r pred_lda_h2, exercise=TRUE}
191-
# prédiction
191+
# prédiction
192192
rice_pred <- ___(___, ___)
193193
# matrice de confusion
194194
rice_conf <- confusion(___, ___$___)
@@ -221,7 +221,7 @@ grade_code("Vous venez de calculer les métriques de performances du premier cla
221221

222222
```{r lda_pred_cv_h2, exercise=TRUE}
223223
set.seed(76456)
224-
# prédiction
224+
# prédiction
225225
rice_pred_cv <- ___(___, cv.k = ___)
226226
# matrice de confusion
227227
rice_conf_cv <- confusion(___, ___$___)
@@ -259,7 +259,7 @@ quiz(
259259
question("Quel classifieur permet d'avoir le taux d'erreur globale le plus bas ?",
260260
answer("L'analyse discriminante linéaire sans validation croisée"),
261261
answer("L'analyse discriminante linéaire avec validation croisée 10 fois", correct = TRUE),
262-
allow_retry = TRUE,
262+
allow_retry = TRUE,
263263
submit_button = "Soumettre une réponse",
264264
try_again_button = "Resoumettre une réponse",
265265
incorrect = "Mauvaise réponse. Recommencez afin de trouver la bonne réponse",
@@ -303,3 +303,15 @@ question_text(
303303
allow_retry = TRUE
304304
)
305305
```
306+
307+
```{css, echo=FALSE}
308+
@media print {
309+
.topics {
310+
width: 100% !important;
311+
padding: 0 0.5em 0 !important;
312+
}
313+
.topicsContainer, .topicsContainer *, .learnrBanner, .learnrBanner *, .topicActions, .topicActions * {
314+
display: none !important;
315+
}
316+
}
317+
```

inst/tutorials/C02Lb_ml2/C02Lb_ml2.Rmd.inactivated

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pumpkins_rf <- mlRforest(data = pumpkins_train, class ~ ., ntree = 100)
3939
predict(pumpkins_knn, pumpkins_test) |> confusion(pumpkins_test$class) |> summary() ->
4040
conf_knn
4141
## Partitionnement récursif
42-
predict(pumpkins_part, pumpkins_test) |> confusion(pumpkins_test$class) |> summary() ->
42+
predict(pumpkins_part, pumpkins_test) |> confusion(pumpkins_test$class) |> summary() ->
4343
conf_part
4444
## forêt aléatoire
4545
predict(pumpkins_rf, pumpkins_test) |> confusion(pumpkins_test$class) |> summary() ->
@@ -220,7 +220,7 @@ quiz(
220220
answer(sprintf("%.4f", conf_knn["Cercevelik",]$Precision)),
221221
answer(sprintf("%.4f", conf_knn["Cercevelik",]$Fscore)),
222222
answer(sprintf("%.4f", conf_knn["Cercevelik",]$FDR)),
223-
allow_retry = TRUE,
223+
allow_retry = TRUE,
224224
submit_button = "Soumettre une réponse",
225225
try_again_button = "Resoumettre une réponse",
226226
incorrect = "Mauvaise réponse. Recommencez et analysez plus finement les métriques calculées pour ce classifieur.",
@@ -230,7 +230,7 @@ quiz(
230230
answer(sprintf("%.4f", conf_part["Urgup Sivrisi",]$Precision)),
231231
answer(sprintf("%.4f", conf_part["Urgup Sivrisi",]$Fscore)),
232232
answer(sprintf("%.4f", conf_part["Urgup Sivrisi",]$FDR)),
233-
allow_retry = TRUE,
233+
allow_retry = TRUE,
234234
submit_button = "Soumettre une réponse",
235235
try_again_button = "Resoumettre une réponse",
236236
incorrect = "Mauvaise réponse. Recommencez et analysez plus finement les métriques calculées pour ce classifieur.",
@@ -261,3 +261,15 @@ question_text(
261261
allow_retry = TRUE
262262
)
263263
```
264+
265+
```{css, echo=FALSE}
266+
@media print {
267+
.topics {
268+
width: 100% !important;
269+
padding: 0 0.5em 0 !important;
270+
}
271+
.topicsContainer, .topicsContainer *, .learnrBanner, .learnrBanner *, .topicActions, .topicActions * {
272+
display: none !important;
273+
}
274+
}
275+
```

inst/tutorials/C03La_roc/C03La_roc.Rmd.inactivated

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ runtime: shiny_prerendered
1414

1515
```{r setup, include=FALSE}
1616
BioDataScience3::learnr_setup()
17-
SciViews::R("ml")
17+
SciViews::R("ml")
1818

1919
# Importation des données
2020
breast <- read("BreastCancer", package = "mlbench")
@@ -26,7 +26,7 @@ breast <- sselect(breast, -id)
2626
## rpart1
2727
set.seed(12)
2828
breast_part <- ml_rpart(data = breast, class ~ .)
29-
breast_pred1 <- cvpredict(breast_part, cv.k = 5)
29+
breast_pred1 <- cvpredict(breast_part, cv.k = 5)
3030
part1_conf <- confusion(breast_pred1, breast$class)
3131
part1_tab <- summary(part1_conf)
3232

@@ -48,7 +48,7 @@ breast2 <- bind_rows(br_m2, br_b2)
4848
set.seed(256)
4949
breast_part2 <- ml_rpart(data = breast2, class ~ .)
5050
# Évaluation du classifieur
51-
breast_pred2 <- cvpredict(breast_part2, cv.k = 5)
51+
breast_pred2 <- cvpredict(breast_part2, cv.k = 5)
5252
part2_conf <- confusion(breast_pred2, breast2$class)
5353
part2_tab <- summary(part2_conf)
5454

@@ -65,7 +65,7 @@ part2_conf2_tab <- summary(part2_conf2)
6565

6666
# Courbe ROC
6767
set.seed(875467)
68-
breast_pred <- cvpredict(breast_part, cv.k = 5, type = "membership")
68+
breast_pred <- cvpredict(breast_part, cv.k = 5, type = "membership")
6969
#head(breast_pred)
7070
```
7171

@@ -160,7 +160,7 @@ question("Quel est le taux de vrais positifs pour les personnes malades ?",
160160
answer(sprintf("%.4f", part1_tab["malignant",]$Specificity)),
161161
answer(sprintf("%.4f", part1_tab["malignant",]$LRPT)),
162162
answer(sprintf("%.4f", part1_tab["malignant",]$FDR)),
163-
allow_retry = TRUE,
163+
allow_retry = TRUE,
164164
submit_button = "Soumettre une réponse",
165165
try_again_button = "Resoumettre une réponse",
166166
incorrect = "Mauvaise réponse. Recommencez et analysez plus finement les métriques associées à ce classifieur.",
@@ -240,14 +240,14 @@ Calculez le second classifieur `breast_part2` comme le premier, mais avec ce sec
240240
set.seed(256)
241241
breast_part2 <- ml___(data = ___, ___~___)
242242
part2_conf <- confusion(cvpredict(breast_part2, cv.k = ___), ___$___)
243-
summary(part2_conf)
243+
summary(part2_conf)
244244
```
245245

246246
```{r rpart2_h2-hint-1}
247247
set.seed(256)
248248
breast_part2 <- ml_rpart(data = breast2, class ~ .)
249249
part2_conf <- confusion(cvpredict(breast_part2, cv.k = ___), ___$___)
250-
summary(part2_conf)
250+
summary(part2_conf)
251251

252252
## Attention, le prochain indice est la solution ##
253253
```
@@ -257,7 +257,7 @@ summary(part2_conf)
257257
set.seed(256)
258258
breast_part2 <- ml_rpart(data = breast2, class ~ .)
259259
part2_conf <- confusion(cvpredict(breast_part2, cv.k = 5), breast2$class)
260-
summary(part2_conf)
260+
summary(part2_conf)
261261
```
262262

263263
```{r rpart2_h2-check}
@@ -307,7 +307,7 @@ quiz(
307307
answer(sprintf("%.4f", part2_tab["malignant",]$Precision)),
308308
answer(sprintf("%.4f", part1_tab["malignant",]$Precision)),
309309
answer(sprintf("%.4f", part2_conf2_tab["benign",]$Precision)),
310-
allow_retry = TRUE,
310+
allow_retry = TRUE,
311311
submit_button = "Soumettre une réponse",
312312
try_again_button = "Resoumettre une réponse",
313313
incorrect = "Mauvaise réponse. Recommencez et analysez plus finement les métriques associées aux classifieurs.",
@@ -317,7 +317,7 @@ quiz(
317317
answer(sprintf("%.4f", part2_tab["malignant",]$Specificity)),
318318
answer(sprintf("%.4f", part1_tab["malignant",]$Fscore)),
319319
answer(sprintf("%.4f", part2_conf2_tab["malignant",]$FDR)),
320-
allow_retry = TRUE,
320+
allow_retry = TRUE,
321321
submit_button = "Soumettre une réponse",
322322
try_again_button = "Resoumettre une réponse",
323323
incorrect = "Mauvaise réponse. Recommencez et analysez plus finement les métriques associés aux classifieurs.",
@@ -331,7 +331,7 @@ Dans la section précédente, nous avons altéré les proportions relatives dans
331331

332332
```{r, echo=TRUE}
333333
set.seed(875467)
334-
breast_pred <- cvpredict(breast_part, cv.k = 5, type = "membership")
334+
breast_pred <- cvpredict(breast_part, cv.k = 5, type = "membership")
335335
head(breast_pred)
336336
```
337337

@@ -410,3 +410,15 @@ question_text(
410410
allow_retry = TRUE
411411
)
412412
```
413+
414+
```{css, echo=FALSE}
415+
@media print {
416+
.topics {
417+
width: 100% !important;
418+
padding: 0 0.5em 0 !important;
419+
}
420+
.topicsContainer, .topicsContainer *, .learnrBanner, .learnrBanner *, .topicActions, .topicActions * {
421+
display: none !important;
422+
}
423+
}
424+
```

inst/tutorials/C03Lb_ml3/C03Lb_ml3.Rmd.inactivated

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ quiz(
207207
answer("Machine à vecteurs supports avec un noyau linéaire", correct = TRUE),
208208
answer("Machine à vecteurs supports à noyau radial"),
209209
answer("Réseaux de neurones artificiels"),
210-
allow_retry = TRUE,
210+
allow_retry = TRUE,
211211
submit_button = "Soumettre une réponse",
212212
try_again_button = "Resoumettre une réponse",
213213
incorrect = "Mauvaise réponse. Recommencez et analysez les métriques des trois classifieurs.",
@@ -216,7 +216,7 @@ quiz(
216216
answer("Machine à vecteurs supports avec un noyau linéaire", correct = TRUE),
217217
answer("Machine à vecteurs supports à noyau radial"),
218218
answer("Réseaux de neurones artificiels"),
219-
allow_retry = TRUE,
219+
allow_retry = TRUE,
220220
submit_button = "Soumettre une réponse",
221221
try_again_button = "Resoumettre une réponse",
222222
incorrect = "Mauvaise réponse. Recommencez et analysez les métriques des trois classifieurs.",
@@ -237,3 +237,15 @@ question_text(
237237
allow_retry = TRUE
238238
)
239239
```
240+
241+
```{css, echo=FALSE}
242+
@media print {
243+
.topics {
244+
width: 100% !important;
245+
padding: 0 0.5em 0 !important;
246+
}
247+
.topicsContainer, .topicsContainer *, .learnrBanner, .learnrBanner *, .topicActions, .topicActions * {
248+
display: none !important;
249+
}
250+
}
251+
```

inst/tutorials/C04La_ts_intro/C04La_ts_intro.Rmd.inactivated

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,15 @@ question_text(
288288
allow_retry = TRUE
289289
)
290290
```
291+
292+
```{css, echo=FALSE}
293+
@media print {
294+
.topics {
295+
width: 100% !important;
296+
padding: 0 0.5em 0 !important;
297+
}
298+
.topicsContainer, .topicsContainer *, .learnrBanner, .learnrBanner *, .topicActions, .topicActions * {
299+
display: none !important;
300+
}
301+
}
302+
```

inst/tutorials/C04Lb_ts_analysis/C04Lb_ts_analysis.Rmd.towrite

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,18 @@ BioDataScience3::learnr_server(input, output, session)
3535
- ...
3636

3737
## Autocorrélation
38+
39+
...
40+
41+
42+
```{css, echo=FALSE}
43+
@media print {
44+
.topics {
45+
width: 100% !important;
46+
padding: 0 0.5em 0 !important;
47+
}
48+
.topicsContainer, .topicsContainer *, .learnrBanner, .learnrBanner *, .topicActions, .topicActions * {
49+
display: none !important;
50+
}
51+
}
52+
```

inst/tutorials/C05La_ts_filter/C05La_ts_filter.Rmd.inactivated

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,16 @@ Calculez des statistiques glissantes afin de délimiter les périodes de 0 à 5,
181181
```{r sl_h2, exercise = TRUE}
182182
sl <- stat.slide(___(___), ___, xcut = c(___, ___, ___, ___, ___))
183183
# Graphique de l'objet `sl`
184-
plot(__, stat = ___, leg = ___, lpos = c(___, ___),
185-
xlab = ___, ylab = ____,
184+
plot(__, stat = ___, leg = ___, lpos = c(___, ___),
185+
xlab = ___, ylab = ____,
186186
main = ___)
187187
```
188188

189189
```{r sl_h2-hint-1}
190190
sl <- stat.slide(___(___), ___, xcut = c(0, 5, 15, 25, 36))
191191
# Graphique de l'objet `sl`
192-
plot(sl, stat = ___, leg = TRUE, lpos = c(1, 182),
193-
xlab = ___, ylab = ____,
192+
plot(sl, stat = ___, leg = TRUE, lpos = c(1, 182),
193+
xlab = ___, ylab = ____,
194194
main = ___)
195195

196196
## Attention, le prochain indice est la solution ##
@@ -200,9 +200,9 @@ plot(sl, stat = ___, leg = TRUE, lpos = c(1, 182),
200200
## Solution ##
201201
sl <- stat.slide(time(hr_filtered), hr_filtered, xcut = c(0, 5, 15, 25, 36))
202202
# Graphique de l'objet `sl`
203-
plot(sl, stat = "median", leg = TRUE, lpos = c(1, 182),
204-
xlab = "Temps [min]", ylab = "Fréquence cardiaque [bpm]",
205-
main = "Statistiques glissantes")
203+
plot(sl, stat = "median", leg = TRUE, lpos = c(1, 182),
204+
xlab = "Temps [min]", ylab = "Fréquence cardiaque [bpm]",
205+
main = "Statistiques glissantes")
206206
```
207207

208208
```{r sl_h2-check}
@@ -226,3 +226,15 @@ question_text(
226226
allow_retry = TRUE
227227
)
228228
```
229+
230+
```{css, echo=FALSE}
231+
@media print {
232+
.topics {
233+
width: 100% !important;
234+
padding: 0 0.5em 0 !important;
235+
}
236+
.topicsContainer, .topicsContainer *, .learnrBanner, .learnrBanner *, .topicActions, .topicActions * {
237+
display: none !important;
238+
}
239+
}
240+
```

0 commit comments

Comments
 (0)