Lecture 11
Supervised Learning Artificial Neural Networks
Marco Chiarandini
Department of Mathematics & Computer Science University of Southern Denmark
Supervised Learning Artificial Neural Networks Marco Chiarandini - - PowerPoint PPT Presentation
Lecture 11 Supervised Learning Artificial Neural Networks Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Slides by Stuart Russell and Peter Norvig Neural Networks Course Overview Other
Department of Mathematics & Computer Science University of Southern Denmark
Neural Networks Other Methods and Issues
2
Neural Networks Other Methods and Issues
3
Neural Networks Other Methods and Issues
Axon Cell body or Soma Nucleus Dendrite Synapses Axonal arborization Axon from another cell Synapse
4
Neural Networks Other Methods and Issues
5
Neural Networks Other Methods and Issues
6
Neural Networks Other Methods and Issues
7
Neural Networks Other Methods and Issues
8
Neural Networks Other Methods and Issues
j
9
Neural Networks Other Methods and Issues
10
Neural Networks Other Methods and Issues
AND
OR
NOT
11
Neural Networks Other Methods and Issues
13
Neural Networks Other Methods and Issues
14
Neural Networks Other Methods and Issues
15
Neural Networks Other Methods and Issues
16
Neural Networks Other Methods and Issues
17
Neural Networks Other Methods and Issues
18
Neural Networks Other Methods and Issues
n
j
j + α · Err · g ′(in) · xj
19
Neural Networks Other Methods and Issues
j=0 Wjxj[e]
20
Neural Networks Other Methods and Issues
4 5 6 7 8 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 Petal Dimensions in Iris Blossoms Length Width
S S S S S SS S S S SS S S S S S S S S S S S S S V V V V V V V V V V V V V V V V V V V V V V V V V
S V Setosa Petals Versicolor Petals
> head(iris.data) Sepal.Length Sepal.Width Species id 6 5.4 3.9 setosa -1 4 4.6 3.1 setosa -1 84 6.0 2.7 versicolor 1 31 4.8 3.1 setosa -1 77 6.8 2.8 versicolor 1 15 5.8 4.0 setosa -1
21
> sigma <- function(w, point) { + x <- c(point, 1) + sign(w %*% x) + } > w.0 <- c(runif(1), runif(1), runif(1)) > w.t <- w.0 > for (j in 1:1000) { + i <- (j - 1)%%50 + 1 + diff <- iris.data[i, 4] - sigma(w.t, c(iris.data[i, 1], iris.data[i, 2])) + w.t <- w.t + 0.2 * diff * c(iris.data[i, 1], iris.data[i, 2], 1) + }
4 5 6 7 8 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5
Petal Dimensions in Iris Blossoms
Length Width S S S S S S S S S S S S S S S S S S S S S S S S S V V V V V V V V V V V V V V V V V V V V V V V V V S V Setosa Petals Versicolor Petals S S S S S S S S S S S S S S S S S S S S S S S S S V V V V V V V V V V V V V V V V V V V V V V V V V
Neural Networks Other Methods and Issues
1,3 1,4
2,3
2,4
3,5 4,5
24
Neural Networks Other Methods and Issues
25
Neural Networks Other Methods and Issues
27
Neural Networks Other Methods and Issues
28
Neural Networks Other Methods and Issues
k,j
29
Neural Networks Other Methods and Issues
30
Neural Networks Other Methods and Issues
j
31
Neural Networks Other Methods and Issues
j
32
Neural Networks Other Methods and Issues
Petal.Length Petal.Width Sepal.Length setosa Petal.Length Petal.Width Sepal.Length versicolor Petal.Length Petal.Width Sepal.Length virginica
Petal.Width Sepal.Length
33
Neural Networks Other Methods and Issues
> samp <- c(sample(1:50, 25), sample(51:100, 25), sample(101:150, 25)) > Target <- class.ind(iris$Species) > ir.nn <- nnet(Target ~ Sepal.Length * Petal.Length * Petal.Width, data = iris, subset = samp, + size = 2, rang = 0.1, decay = 5e-04, maxit = 200, trace = FALSE) > test.cl <- function(true, pred) { + true <- max.col(true) + cres <- max.col(pred) + table(true, cres) + } > test.cl(Target[-samp, ], predict(ir.nn, iris[-samp, c(1, 3, 4)])) cres true 1 2 3 1 25 2 0 22 3 3 2 23
34
Neural Networks Other Methods and Issues
35
Neural Networks Other Methods and Issues
36
Neural Networks Other Methods and Issues
37
Neural Networks Other Methods and Issues
38
Neural Networks Other Methods and Issues
39
Neural Networks Other Methods and Issues
40
Neural Networks Other Methods and Issues
41
Neural Networks Other Methods and Issues
42
Neural Networks Other Methods and Issues
43
Neural Networks Other Methods and Issues
44