Skip to content

Commit 35406c1

Browse files
committed
details
1 parent 8e8bc55 commit 35406c1

1 file changed

Lines changed: 45 additions & 44 deletions

File tree

stat-R_2020/apprentissage/cours_apprentissage.Rmd

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
----
1+
---
22
title: "Module 3 - Méthodes d'apprentissage avec R - Séance 7"
3-
author: "Frédéric Guyon,updated by Jacques van Helden"
3+
author: "Frédéric Guyon, updated by Jacques van Helden"
44
date: '`r Sys.Date()`'
55
output:
6-
beamer_presentation:
7-
colortheme: dolphin
8-
fig_caption: yes
9-
fig_height: 6
10-
fig_width: 7
11-
fonttheme: structurebold
12-
highlight: tango
6+
slidy_presentation:
7+
highlight: default
138
incremental: no
14-
keep_tex: no
9+
smart: no
1510
slide_level: 2
16-
theme: Montpellier
11+
self_contained: no
12+
fig_caption: no
13+
fig_height: 5
14+
fig_width: 5
15+
keep_md: yes
16+
smaller: yes
17+
theme: cerulean
1718
toc: yes
19+
widescreen: yes
1820
html_document:
1921
fig_caption: yes
2022
highlight: zenburn
@@ -23,51 +25,42 @@ output:
2325
toc: yes
2426
toc_depth: 3
2527
toc_float: yes
26-
ioslides_presentation:
27-
colortheme: dolphin
28-
fig_caption: yes
29-
fig_height: 6
30-
fig_width: 7
31-
fonttheme: structurebold
32-
highlight: tango
33-
self_contained: no
28+
beamer_presentation:
29+
theme: Hannover #Montpellier
30+
colortheme: beaver
31+
fonttheme: professionalfonts #structurebold
32+
highlight: pygments #default
33+
fig_caption: no
34+
fig_height: 4
35+
fig_width: 5
36+
incremental: no
37+
keep_tex: no
3438
slide_level: 2
35-
smaller: yes
3639
toc: yes
37-
widescreen: yes
3840
pdf_document:
3941
fig_caption: yes
4042
highlight: zenburn
4143
toc: yes
4244
toc_depth: 3
4345
revealjs::revealjs_presentation:
44-
css: ../slides.css
45-
self_contained: yes
4646
theme: night
4747
transition: none
48-
slidy_presentation:
49-
fig_caption: yes
50-
fig_height: 6
51-
fig_width: 7
52-
highlight: tango
53-
incremental: no
54-
keep_md: yes
55-
self_contained: yes
48+
self_contained: true
5649
slide_level: 2
57-
smaller: yes
58-
smart: no
59-
theme: cerulean
60-
toc: yes
61-
widescreen: yes
50+
css: ../slides.css
51+
ioslides_presentation:
52+
highlight: zenburn
53+
incremental: no
6254
font-import: http://fonts.googleapis.com/css?family=Risque
63-
subtitle: DUBii 2019
6455
font-family: Garamond
6556
transition: linear
57+
editor_options:
58+
chunk_output_type: console
6659
---
6760

6861
```{r include=FALSE, echo=FALSE, eval=TRUE}
6962
library(knitr)
70-
library(kableExtra)
63+
# library(kableExtra)
7164
library(png)
7265
library(grid)
7366
library(rpart.plot)
@@ -83,7 +76,7 @@ options(width = 300)
8376
# options(encoding = 'UTF-8')
8477
knitr::opts_chunk$set(
8578
fig.width = 7, fig.height = 5,
86-
fig.path = 'figures/07_tests_multiples',
79+
fig.path = 'figures/cours_apprentissage_',
8780
fig.align = "center",
8881
size = "tiny",
8982
echo = TRUE, eval = TRUE,
@@ -140,14 +133,15 @@ d'évaluation : TIMIT (Reconnaissance de la parole), MNIST
140133
(images de chiffres manuscrits)
141134

142135

143-
# Support Vecteur Machine
136+
## Support Vecteur Machines (SVM)
144137

145-
## Séparation linéaire: deux classes
138+
Séparation linéaire: deux classes
146139

147140
```{r mult_separated_groups, echo=FALSE, out.width="50%", fig.cap="2 groupes, pas de séparation unique"}
148141
include_graphics(path = "img/SepLin3.pdf")
149142
```
150-
## Marge entre classes séparables
143+
144+
## SVM - Marge entre classes séparables
151145

152146
- Marge: distance au point le plus proche
153147
- Recherche du plan qui maximise cette marge
@@ -198,7 +192,7 @@ table(ypred, iris[,5])
198192
## Exemple 2: classification non séparable
199193

200194
```{r, results = FALSE, out.width="50%", fig.width=7, fig.height=5}
201-
Data=read.table("data/cercles.dms")
195+
Data <- read.table("data/cercles.dms")
202196
X=as.matrix(Data[,1:2])
203197
y=Data[,3]
204198
plot(X,col=y)
@@ -237,6 +231,7 @@ $y= \sigma\left(w_0 + w_1 x_1 + w_2 x_2 + \dots \right)$
237231
```{r echo=FALSE, out.width="25%",fig.cap="A sigmoid function"}
238232
include_graphics(path = "img/sigmoid.pdf")
239233
```
234+
240235
## Réseaux de neurones : le neurone
241236
```{r echo=FALSE, out.width="50%",fig.cap="A neural network"}
242237
include_graphics(path = "img/NN2.pdf")
@@ -251,7 +246,9 @@ include_graphics(path = "img/NN2.pdf")
251246
- une couche de sortie avec fonction d'activation linéaire ou softmax
252247

253248
## Fonction nnet: 1 couche cachée
254-
### Exemple iris avec réseau de neurones
249+
250+
## Exemple iris avec réseau de neurones
251+
255252
```{r, results = FALSE}
256253
library(nnet)
257254
X=as.matrix(iris[,1:4])
@@ -262,14 +259,17 @@ model=nnet(X,Y, size=2, softmax=TRUE)
262259
ypred=max.col(predict(model,X))
263260
table(y, ypred)
264261
```
262+
265263
## Ou bien
264+
266265
```{r, results = FALSE}
267266
model=nnet(Species~.,data=iris, size=2)
268267
ypred=max.col(predict(model,X))
269268
table(y, ypred)
270269
```
271270

272271
## Plus sérieusement, avec évaluation
272+
273273
```{r, results = FALSE}
274274
ind_app=sample(1:nrow(iris),50)
275275
Xapp=iris[ind_app,1:4]
@@ -282,6 +282,7 @@ model=nnet(Xapp,Yapp, size=2, softmax=TRUE)
282282
```
283283

284284
## Evaluation des erreurs
285+
285286
```{r, results = FALSE}
286287
# erreur d'apprentissage
287288
ypred=max.col(predict(model,Xapp))

0 commit comments

Comments
 (0)