1 Chapter 6: Artificial Neural Networks Part 2 of 3 (Sections 6.4 – 6.6) Asst. Prof. Dr. Sukanya Pongsuparb Dr. Srisupa Palakvangsa Na Ayudhya Dr. Benjarath.

Slides:



Advertisements
Similar presentations
Artificial Neural Networks
Advertisements

© Negnevitsky, Pearson Education, Lecture 7 Artificial neural networks: Supervised learning Introduction, or how the brain works Introduction, or.
Multi-Layer Perceptron (MLP)
NEURAL NETWORKS Backpropagation Algorithm
1 Machine Learning: Lecture 4 Artificial Neural Networks (Based on Chapter 4 of Mitchell T.., Machine Learning, 1997)
1 Neural networks. Neural networks are made up of many artificial neurons. Each input into the neuron has its own weight associated with it illustrated.
Multilayer Perceptrons 1. Overview  Recap of neural network theory  The multi-layered perceptron  Back-propagation  Introduction to training  Uses.
Mehran University of Engineering and Technology, Jamshoro Department of Electronic Engineering Neural Networks Feedforward Networks By Dr. Mukhtiar Ali.
Kostas Kontogiannis E&CE
Machine Learning: Connectionist McCulloch-Pitts Neuron Perceptrons Multilayer Networks Support Vector Machines Feedback Networks Hopfield Networks.
Machine Learning Neural Networks
Simple Neural Nets For Pattern Classification
The back-propagation training algorithm
Prénom Nom Document Analysis: Artificial Neural Networks Prof. Rolf Ingold, University of Fribourg Master course, spring semester 2008.
Pattern Association A pattern association learns associations between input patterns and output patterns. One of the most appealing characteristics of.
Carla P. Gomes CS4700 CS 4700: Foundations of Artificial Intelligence Prof. Carla P. Gomes Module: Neural Networks: Concepts (Reading:
1 Chapter 11 Neural Networks. 2 Chapter 11 Contents (1) l Biological Neurons l Artificial Neurons l Perceptrons l Multilayer Neural Networks l Backpropagation.
Prénom Nom Document Analysis: Artificial Neural Networks Prof. Rolf Ingold, University of Fribourg Master course, spring semester 2008.
Lecture 08 Classification-based Learning
Data Mining with Neural Networks (HK: Chapter 7.5)
LOGO Classification III Lecturer: Dr. Bo Yuan
CHAPTER 11 Back-Propagation Ming-Feng Yeh.
CS 484 – Artificial Intelligence
Neural Networks. Background - Neural Networks can be : Biological - Biological models Artificial - Artificial models - Desire to produce artificial systems.
Artificial Neural Network
BEE4333 Intelligent Control
Artificial neural networks:
Artificial neural networks:
© Negnevitsky, Pearson Education, Lecture 7 Artificial neural networks: Supervised learning Introduction, or how the brain works Introduction, or.
Artificial Neural Networks
Neural NetworksNN 11 Neural netwoks thanks to: Basics of neural network theory and practice for supervised and unsupervised.
Artificial Neural Nets and AI Connectionism Sub symbolic reasoning.
11 CSE 4705 Artificial Intelligence Jinbo Bi Department of Computer Science & Engineering
© Negnevitsky, Pearson Education, Lecture 8 (chapter 6) Artificial neural networks: Supervised learning The perceptron Quick Review The perceptron.
Machine Learning Dr. Shazzad Hosain Department of EECS North South Universtiy
1 Machine Learning The Perceptron. 2 Heuristic Search Knowledge Based Systems (KBS) Genetic Algorithms (GAs)
Pattern Classification All materials in these slides were taken from Pattern Classification (2nd ed) by R. O. Duda, P. E. Hart and D. G. Stork, John Wiley.
Artificial Neural Network Supervised Learning دكترمحسن كاهاني
NEURAL NETWORKS FOR DATA MINING
 Diagram of a Neuron  The Simple Perceptron  Multilayer Neural Network  What is Hidden Layer?  Why do we Need a Hidden Layer?  How do Multilayer.
ECE 8443 – Pattern Recognition ECE 8527 – Introduction to Machine Learning and Pattern Recognition LECTURE 16: NEURAL NETWORKS Objectives: Feedforward.
Artificial Intelligence Techniques Multilayer Perceptrons.
Artificial Neural Networks. The Brain How do brains work? How do human brains differ from that of other animals? Can we base models of artificial intelligence.
10/17/2015Intelligent Systems and Soft Computing1 Lecture 7 Artificial neural networks: Supervised learning Introduction, or how the brain works Introduction,
1 Chapter 11 Neural Networks. 2 Chapter 11 Contents (1) l Biological Neurons l Artificial Neurons l Perceptrons l Multilayer Neural Networks l Backpropagation.
Multi-Layer Perceptron
Non-Bayes classifiers. Linear discriminants, neural networks.
Back-Propagation Algorithm AN INTRODUCTION TO LEARNING INTERNAL REPRESENTATIONS BY ERROR PROPAGATION Presented by: Kunal Parmar UHID:
CS621 : Artificial Intelligence
Neural Networks Teacher: Elena Marchiori R4.47 Assistant: Kees Jong S2.22
EEE502 Pattern Recognition
Neural Networks 2nd Edition Simon Haykin
Artificial Intelligence CIS 342 The College of Saint Rose David Goldschmidt, Ph.D.
Chapter 6 Neural Network.
Artificial Intelligence Methods Neural Networks Lecture 3 Rakesh K. Bissoondeeal Rakesh K. Bissoondeeal.
Bab 5 Classification: Alternative Techniques Part 4 Artificial Neural Networks Based Classifer.
Assocative Neural Networks (Hopfield) Sule Yildirim 01/11/2004.
Pattern Recognition Lecture 20: Neural Networks 3 Dr. Richard Spillman Pacific Lutheran University.
 Negnevitsky, Pearson Education, Lecture 7 Artificial neural networks: Supervised learning n Introduction, or how the brain works n The neuron.
CSE343/543 Machine Learning Mayank Vatsa Lecture slides are prepared using several teaching resources and no authorship is claimed for any slides.
Neural networks.
Learning in Neural Networks
Artificial neural networks:
Intelligent Systems and Soft Computing
with Daniel L. Silver, Ph.D. Christian Frey, BBA April 11-12, 2017
of the Artificial Neural Networks.
CS621: Artificial Intelligence Lecture 22-23: Sigmoid neuron, Backpropagation (Lecture 20 and 21 taken by Anup on Graphical Models) Pushpak Bhattacharyya.
AI Lectures by Engr.Q.Zia
Presentation transcript:

1 Chapter 6: Artificial Neural Networks Part 2 of 3 (Sections 6.4 – 6.6) Asst. Prof. Dr. Sukanya Pongsuparb Dr. Srisupa Palakvangsa Na Ayudhya Dr. Benjarath Pupacdi SCCS451 Artificial Intelligence Week 12

2 Agenda Multi-layer Neural Network Hopfield Network

3 Multilayer Neural Networks A multilayer perceptron is a feedforward neural network with ≥ 1 hidden layers. Single-layer VS Multi-layer Neural Networks

4 Roles of Layers Input Layer Accepts input signals from outside world Distributes the signals to neurons in hidden layer Usually does not do any computation Output Layer (computational neurons) Accepts output signals from the previous hidden layer Outputs to the world Knows the desired outputs Hidden Layer (computational neurons) Determines its own desired outputs

5 Hidden (Middle) Layers Neurons in hidden layers unobservable through input and output of the networks. Desired output unknown (hidden) from the outside and determined by the layer itself 1 hidden layer for continuous functions 2 hidden layers for discontinuous functions Practical applications mostly use 3 layers More layers are possible but each additional layer exponentially increases computing load

6 How do multilayer neural networks learn? More than a hundred different learning algorithms are available for multilayer ANNs The most popular method is back-propagation.

7 Back-propagation Algorithm In a back-propagation neural network, the learning algorithm has 2 phases. 1.Forward propagation of inputs 2.Backward propagation of errors The algorithm loops over the 2 phases until the errors obtained are lower than a certain threshold. Learning is done in a similar manner as in a perceptron A set of training inputs is presented to the network. The network computes the outputs. The weights are adjusted to reduce errors. The activation function used is a sigmoid function.

8 Common Activation Functions Hard limit functions often used for decision-making neurons for classification and pattern recognition Popular in back- propagation networks Often used for linear approximation Output is a real number in the [0, 1] range.

9 3-layer Back-propagation Neural Network

10 How a neuron determines its output Very similar to the perceptron 1. Compute the net weighted input 2. Pass the result to the activation function jj X = (0.1(2) + 0.2(5) + 0.5(1) + 0.3(8)) – 0.2 = 3.9 Y = 1 / (1 + e -3.9 ) = 0.98 Let θ = Input Signals

11 How the errors propagate backward The errors are computes in a similar manner to the errors in the perceptron. Error = The output we want – The output we get Error at an output neuron k at iteration p kk e k (p) = 1 – 0.98 = 0.02 Suppose the expected output is Iteration p Error Signals

12 Back-Propagation Training Algorithm Step 1: Initialization Randomly define weights and threshold θ such that the numbers are within a small range where F i is the total number of inputs of neuron i. The weight initialization is done on a neuron-by-neuron basis.

13 Back-Propagation Training Algorithm Step 2: Activation Propagate the input signals forward from the input layer to the output layer. jj X = (0.1(2) + 0.2(5) + 0.5(1) + 0.3(8)) – 0.2 = 3.9 Y = 1 / (1 + e -3.9 ) = 0.98 Let θ = Input Signals

14 Back-Propagation Training Algorithm Step 3: Weight Training There are 2 types of weight training 1.For the output layer neurons 2.For the hidden layer neurons *** It is important to understand that first the input signals propagate forward, and then the errors propagate backward to help train the weights. *** In each iteration (p + 1), the weights are updated based on the weights from the previous iteration p. The signals keep flowing forward and backward until the errors are below some preset threshold value.

Weight Training (Output layer neurons) These formulas are used to perform weight corrections. kk 1 2 m w 1,k w 2,k w m,k y k (p) Iteration p j w j,k e k (p) = y d,k (p) - y k (p) δ = error gradient

16 We want to compute thisWe know this predefined We know how to compute this We know how to compute these kk 1 2 m w 1,k w 2,k w m,k y k (p) Iteration p j w j,k e k (p) = y d,k (p) - y k (p) We do the above for each of the weights of the outer layer neurons.

Weight Training (Hidden layer neurons) These formulas are used to perform weight corrections. jj 1 2 n w 1,j w 2,j w n,j Iteration p i w i,j 1 2 l k

18 We want to compute thisWe know this predefined input We do the above for each of the weights of the hidden layer neurons. Propagates from the outer layer We know this jj 1 2 n w 1,j w 2,j w n,j Iteration p i w i,j 1 2 l k We know how to compute these

19 P = 1

20 Weights trained P = 1

21 After the weights are trained in p = 1, we go back to Step 2 (Activation) and compute the outputs for the new weights. If the errors obtained via the use of the updated weights are still above the error threshold, we start weight training for p = 2. Otherwise, we stop.

22 P = 2

23 Weights trained P = 2

24 Example: 3-layer ANN for XOR x 2 or input 2 x 1 or input 1 (1, 1) (1, 0) (0, 1) (0, 0) XOR is not a linearly separable function. A single-layer ANN or the perceptron cannot deal with problems that are not linearly separable. We cope with these problem using multi-layer neural networks.

25 Example: 3-layer ANN for XOR (Non-computing) Let α = 0.1

26 Example: 3-layer ANN for XOR 26 Training set: x 1 = x 2 = 1 and y d,5 = Calculate y 3 = sigmoid( ) = Calculate y 4 = sigmoid( ) = y 5 = sigmoid( ) = e = 0 – = – Let α = 0.1

27 Example: 3-layer ANN for XOR (2) 27 Back-propagation of error (p = 1, output layer) y 5 = e = – δ = y 5 x (1-y 5 ) x e = x ( ) x ( ) = Δw j,k (p) = α x y j (p) x δ k (p) Δw 3,5 (1) = 0.1 x x ( ) = Let α = 0.1 w j,k (p+1) = w j,k (p) + Δw j,k (p) w 3,5 (2) = -1.2 – =

28 Example: 3-layer ANN for XOR (3) 28 Back-propagation of error (p = 1, output layer) y 5 = e = – δ = Let α = 0.1 w 4,5 (2) = 1.1 – = Δw j,k (p) = α x y j (p) x δ k (p) Δw 4,5 (1) = 0.1 x x ( ) = w j,k (p+1) = w j,k (p) + Δw j,k (p)

29 Example: 3-layer ANN for XOR (4) 29 Back-propagation of error (p = 1, output layer) y 5 = e = – δ = Let α = 0.1 θ 5 (2) = = Δθ k (p) = α x y(p) x δ k (p) Δθ 5 (1) = 0.1 x -1 x ( ) = θ 5 (p+1) = θ 5 (p) + Δ θ 5 (p)

30 Example: 3-layer ANN for XOR (5) 30 Back-propagation of error (p = 1, input layer) y 5 = e = – δ = Let α = Δw i,j (p) = α x x i (p) x δ j (p) Δw 1,3 (1) = 0.1 x 1 x = w i,j (p+1) = w i,j (p) + Δw i,j (p) w 1,3 (2) = = δ j (p) = y i (p) x (1-y i (p)) x ∑ [α k (p) w j,k (p)], all k’s δ 3 (p) = x ( ) x ( x -1.2) =

31 Example: 3-layer ANN for XOR (6) 31 Back-propagation of error (p = 1, input layer) y 5 = e = – δ = Let α = Δw i,j (p) = α x x i (p) x δ j (p) Δw 1,4 (1) = 0.1 x 1 x = w i,j (p+1) = w i,j (p) + Δw i,j (p) w 1,4 (2) = = δ j (p) = y i (p) x (1-y i (p)) x ∑ [α k (p) w j,k (p)], all k’s δ 4 (p) = x ( ) x ( x 1.1) =

32 Example: 3-layer ANN for XOR (7) 32 Back-propagation of error (p = 1, input layer) y 5 = e = – δ = Let α = Δw i,j (p) = α x x i (p) x δ j (p) Δw 2,3 (1) = 0.1 x 1 x = w i,j (p+1) = w i,j (p) + Δw i,j (p) w 2,3 (2) = = δ 3 (p) = δ 4 (p) =

33 Example: 3-layer ANN for XOR (8) 33 Back-propagation of error (p = 1, input layer) y 5 = e = – δ = Let α = Δw i,j (p) = α x x i (p) x δ j (p) Δw 2,4 (1) = 0.1 x 1 x = w i,j (p+1) = w i,j (p) + Δw i,j (p) w 2,4 (2) = 1 – = δ 3 (p) = δ 4 (p) =

34 Example: 3-layer ANN for XOR (9) 34 Back-propagation of error (p = 1, input layer) y 5 = e = – δ = Let α = δ 3 (p) = δ 4 (p) = θ 3 (2) = = Δθ k (p) = α x y(p) x δ k (p) Δθ 3 (1) = 0.1 x -1 x = θ 3 (p+1) = θ 3 (p) + Δ θ 3 (p)

35 Example: 3-layer ANN for XOR (10) 35 Back-propagation of error (p = 1, input layer) y 5 = e = – δ = Let α = δ 3 (p) = δ 4 (p) = θ 4 (2) = = Δθ k (p) = α x y(p) x δ k (p) Δθ 4 (1) = 0.1 x -1 x ( ) = θ 4 (p+1) = θ 4 (p) + Δ θ 4 (p)

36 Example: 3-layer ANN for XOR (9) α = 0.1 Now the 1 st iteration (p = 1) is finished. Weight training process is repeated until the sum of squared errors is less than (threshold)

37 Learning Curve for XOR The curve shows ANN learning speed. 224 epochs or 896 iterations were required.

38 Final Results Training again with different initial values may result differently. It works so long as the sum of squared errors is below the preset error threshold.

39 Final Results Different result possible for different initial. But the result always satisfies the criterion.

40 McCulloch-Pitts Model: XOR Op. Activation function: sign function

41 Decision Boundary (a) Decision boundary constructed by hidden neuron 3; (b) Decision boundary constructed by hidden neuron 4; (c) Decision boundaries constructed by the complete three-layer network

42 Problems of Back-Propagation Not similar to the process of a biological neuron Heavy computing load

43 Accelerated Learning in Multi-layer NN (1) Represent sigmoid function by hyperbolic tangent: where a and b are constants. Suitable values: a = and b = 0.667

44 Accelerated Learning in Multi-layer NN (2) Include a momentum term in the delta rule where  is a positive number (0    1) called the momentum constant. Typically, the momentum constant is set to This equation is called the generalized delta rule.

45 Learning with Momentum Reduced from 224 to 126 epochs

46 Accelerated Learning in Multi-layer NN (3) Adaptive learning rate: Idea small   smooth learning curve large   fast learning, possibly instable Heuristic rule: increase learning rate when the change of the sum of squared errors has the same algebraic sign for several consequent epochs. decrease learning rate when the sign alternates for several consequent epochs

47 Effect of Adaptive Learning Rate

48 Momentum + Adaptive Learning Rate

49 The Hopfield Network Neural networks were designed on an analogy with the brain, which has associative memory. We can recognize a familiar face in an unfamiliar environment.  Our brain can recognize certain patterns even though some information about the patterns differ from what we have remembered. Multilayer ANNs are not intrinsically intelligent. Recurrent Neural Networks (RNNs) are used to emulate human’s associative memory. Hopfield network is a RNN.

50 The Hopfield Network: Goal To recognize a pattern even if some parts are not the same as what it was trained to remember. The Hopfield network is a single-layer network. It is recurrent. The network outputs are calculated and then fed back to adjust the inputs. The process continues until the outputs become constant. Let’s see how it works.

51 Single-layer n-neuron Hopfield Network I n p u t S i g n a l s O u t p u t S i g n a l s

52 Activation Function If the neuron’s weighted input is greater than zero, the output is +1. If the neuron’s weighted input is less than zero, the output is -1. If the neuron’s weighted input is zero, the output remains in its previous state.

53 Hopfield Network Current State The current state of the network is determined by the current outputs, i.e. the state vector.

54 What can it recognize? n = the number of inputs = n Each input can be +1 or -1 There are 2 n possible sets of input/output, i.e. patterns. M = total number of patterns that the network was trained with, i.e. the total number of patterns that we want the network to be able to recognize

55 Example: n = 3, 2 3 = 8 possible states

56 Weights Weights between neurons are usually represented in matrix form For example, let’s train the 3D network to recognize the following 2 patterns (M = 2, n = 3) Once the weights are calculated, they remained fixed.            Y               Y

57 Weights (2) M = 2 Thus we can determine the weight matrix as follows            Y               Y  T Y  T Y            I                                     W           

58 How is the Hopfield network tested? Given an input vector X, we calculate the output in a similar manner that we have seen before. Y m = sign(W X m – θ ), m = 1, 2, …, M Θ is the threshold matrix In this case all thresholds are set to zero.

59 Stable States As we see, Y 1 = X 1 and Y 2 = X 2. Thus both states are said to be stable (also called fundamental states).

60 Unstable States With 3 neurons in the network, there are 8 possible states. The remaining 6 states are unstable. Possible StateIteration InputsOutputs Fundamental Memory x1x2x3y1y2y

61 Error Correction Network Each of the unstable states represents a single error, compared to the fundamental memory. The Hopfield network can act as an error correction network.

62 The Hopfield Network The Hopfield network can store a set of fundamental memories. The Hopfield network can recall those fundamental memories when presented with inputs that maybe exactly those memories or slightly different. However, it may not always recall correctly. Let’s see an example.

63 Ex: When Hopfield Network cannot recall X1 = (+1, +1, +1, +1, +1) X2 = (+1, -1, +1, -1, +1) X3 = (-1, +1, -1, +1, -1) Let the probe vector be X = (+1, +1, -1, +1, +1) It is very similar to X1, but the network recalls it as X3. This is a problem with the Hopfield Network

64 Storage capacity of the Hopfield Network Storage capacity is the largest number of fundamental memories that can be stored and retrieved correctly. The maximum number of fundamental memories M max that can be stored in the n-neuron recurrent network is limited by