Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall 2001. Lecture 16. NSLJ Backprop 1 Michael Arbib: CS564 - Brain Theory and Artificial.

Slides:



Advertisements
Similar presentations
Perceptron Lecture 4.
Advertisements

A Brief Overview of Neural Networks By Rohit Dua, Samuel A. Mulder, Steve E. Watkins, and Donald C. Wunsch.
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.
CSC321: 2011 Introduction to Neural Networks and Machine Learning Lecture 7: Learning in recurrent networks Geoffrey Hinton.
5/16/2015Intelligent Systems and Soft Computing1 Introduction Introduction Hebbian learning Hebbian learning Generalised Hebbian learning algorithm Generalised.
Kostas Kontogiannis E&CE
November 19, 2009Introduction to Cognitive Science Lecture 20: Artificial Neural Networks I 1 Artificial Neural Network (ANN) Paradigms Overview: The Backpropagation.
1 Chapter 11 Neural Networks. 2 Chapter 11 Contents (1) l Biological Neurons l Artificial Neurons l Perceptrons l Multilayer Neural Networks l Backpropagation.
CS564 - Brain Theory and Artificial Intelligence, USC, Fall Neural Simulation Language NSL.
CS 4700: Foundations of Artificial Intelligence
CS 484 – Artificial Intelligence
November 21, 2012Introduction to Artificial Intelligence Lecture 16: Neural Network Paradigms III 1 Learning in the BPN Gradients of two-dimensional functions:
Neural Networks. Background - Neural Networks can be : Biological - Biological models Artificial - Artificial models - Desire to produce artificial systems.
Traffic Sign Recognition Using Artificial Neural Network Radi Bekker
CS623: Introduction to Computing with Neural Nets (lecture-10) Pushpak Bhattacharyya Computer Science and Engineering Department IIT Bombay.
Radial Basis Function Networks
Artificial Neural Networks
1 Pattern Recognition: Statistical and Neural Lonnie C. Ludeman Lecture 23 Nov 2, 2005 Nanjing University of Science & Technology.
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.
Introduction to Artificial Neural Network Models Angshuman Saha Image Source: ww.physiol.ucl.ac.uk/fedwards/ ca1%20neuron.jpg.
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.
NEURAL NETWORKS FOR DATA MINING
LINEAR CLASSIFICATION. Biological inspirations  Some numbers…  The human brain contains about 10 billion nerve cells ( neurons )  Each neuron is connected.
Artificial Intelligence Methods Neural Networks Lecture 4 Rakesh K. Bissoondeeal Rakesh K. Bissoondeeal.
Artificial Intelligence Techniques Multilayer Perceptrons.
1 Pattern Recognition: Statistical and Neural Lonnie C. Ludeman Lecture 21 Oct 28, 2005 Nanjing University of Science & Technology.
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.
CS 478 – Tools for Machine Learning and Data Mining Backpropagation.
Back Propagation and Representation in PDP Networks Psychology 209 February 6, 2013.
1 Chapter 11 Neural Networks. 2 Chapter 11 Contents (1) l Biological Neurons l Artificial Neurons l Perceptrons l Multilayer Neural Networks l Backpropagation.
CS344: Introduction to Artificial Intelligence (associated lab: CS386) Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 31: Feedforward N/W; sigmoid.
BACKPROPAGATION: An Example of Supervised Learning One useful network is feed-forward network (often trained using the backpropagation algorithm) called.
Multi-Layer Perceptron
Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 19. Systems Concepts 1 Michael Arbib: CS564 - Brain Theory and.
Neural Network Basics Anns are analytical systems that address problems whose solutions have not been explicitly formulated Structure in which multiple.
CS621 : Artificial Intelligence
Introduction to Neural Networks Introduction to Neural Networks Applied to OCR and Speech Recognition An actual neuron A crude model of a neuron Computational.
Neural Networks Teacher: Elena Marchiori R4.47 Assistant: Kees Jong S2.22
Image Source: ww.physiol.ucl.ac.uk/fedwards/ ca1%20neuron.jpg
Chapter 18 Connectionist Models
C - IT Acumens. COMIT Acumens. COM. To demonstrate the use of Neural Networks in the field of Character and Pattern Recognition by simulating a neural.
Perceptrons Michael J. Watts
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.
Neural Networks Lecture 11: Learning in recurrent networks Geoffrey Hinton.
Kim HS Introduction considering that the amount of MRI data to analyze in present-day clinical trials is often on the order of hundreds or.
CSE343/543 Machine Learning Mayank Vatsa Lecture slides are prepared using several teaching resources and no authorship is claimed for any slides.
Neural networks.
Back Propagation and Representation in PDP Networks
Fall 2004 Backpropagation CS478 - Machine Learning.
Supervised Learning in ANNs
The Gradient Descent Algorithm
CSE P573 Applications of Artificial Intelligence Neural Networks
CS621: Artificial Intelligence
Prof. Carolina Ruiz Department of Computer Science
Artificial Intelligence Methods
BACKPROPAGATION Multlayer Network.
of the Artificial Neural Networks.
network of simple neuron-like computing elements
Neural Network - 2 Mayank Vatsa
Artificial Neural Networks
Computer Vision Lecture 19: Object Recognition III
CSC321: Neural Networks Lecture 11: Learning in recurrent networks
CS621: Artificial Intelligence Lecture 22-23: Sigmoid neuron, Backpropagation (Lecture 20 and 21 taken by Anup on Graphical Models) Pushpak Bhattacharyya.
Artificial Neural Networks / Spring 2002
Prof. Carolina Ruiz Department of Computer Science
Presentation transcript:

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 1 Michael Arbib: CS564 - Brain Theory and Artificial Intelligence University of Southern California, Fall 1999 Lecture 16. [NSLJ] Backprop: a. How to run the model; b. How to write the model Reading Assignments: NSL Book  2.6 Backpropagation  3.5 Backpropagation

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 2 Training and Running The BackPropagation algorithm works in two phases, as in Hopfield. However, these two phases are not to be confused with the feedforward and backpropagation modes:  The training phase adjusts network weights. The training phase is made up of a large number of learning cycles, each comprising a forward pass (feedforward mode) and backward pass (backpropagation mode).  The running phase matches patterns against those already learned by the network. The running phase is made of a single forward pass taking a single cycle although sharing the same forward pass equations (feedforward mode) as in the training phase.

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 3 Feedforward Mode Hidden Layer Layer Output Layer Layer *Warning: the NSL book has typos in these equations.*

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 4 Backpropagation Mode - Output Layer error q = desiredOutput q - actualOutput q The accumulated error tss is given by  q = f (mp q )  error q where for this f the derivative is: f(mp q ) = mf q  (1- mf q ) The resulting  q is then used to modify the thresholds and weights in the output layer as follows  h q = -  q --  is the learning rate parameter h q (t+1) = h q (t) +  h q -- h q (t) is the threshold for output neuron q  w pq = -  q  mf p -- w pq is the weight from hidden unit p to q w pq (t+1) = w pq (t) +  w pq

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 5 Backpropagation Mode - Hidden Layer In this case And then  h p =  p h p (t+1) = h p (t) +  h p  w sp =  p  in s w sp (t+1) = w sp (t) +  w sp

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 6 Model Architecture BackPropModel TrainManager Network Display Results ErrorUpdate xtxt ywyw

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 7 Scheduling and Buffering Scheduling specifies the order in which modules and their corresponding methods are executed. Buffering specifies how often ports read and write data in and out of the module.  In the immediate mode (sequential simulation), output ports immediately send their data to the connecting modules.  In the buffered mode (pseudo-concurrent simulation of, e.g., neural networks), output ports do not send their data to the connecting modules until the following clock cycle: Output ports are double buffered. One buffer contains the data that can be seen by the connecting modules during the current clock cycle, while the other buffer contains the data being currently generated.

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 8 BackPropModel nslImport nslAllImports; nslImport TrainManager; nslImport Network; nslImport DisplayResult; nslModel BackPropModel () { int inSize = 2; int hidSize = 2; int outSize = 1; int nPats = 4; public TrainManager train(nPats,inSize,outSize); public Network network(inSize,hidSize,outSize); public DisplayResult result(inSize, outSize);

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 9 BackPropModel 2 public void initSys() { system.setNumTrainEpochs(1000); system.setTrainEndTime(nPats); system.setRunEndTime(1); } public void initModule() { system.nslSetTrainDelta(1); system.nslSetRunDelta(1); } public void makeConn() { nslConnect(train.x, network.x); nslConnect(train.t, network.t); }

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 10 TrainManager nslImport nslAllImports; nslModule TrainManager (int nPats,int inSize,int outSize) { public NslDoutFloat1 x(inSize); public NslDoutFloat1 t(outSize); private NslFloat2 patterns(nPats, inSize); private NslFloat2 outputs(nPats, outSize); public void simTrain() { int pat = system.getFinishedCycles(); x = nslGetRow(patterns,pat); t = nslGetRow(outputs,pat); }

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 11 Network nslImport nslAllImports; nslImport Error; nslImport Update; nslModule Network (int inSize, int hidSize, int outSize) { public NslDinFloat1 x(inSize); public NslDinFloat1 t(outSize); public NslDoutFloat2 wh(inSize, hidSize); public NslDoutFloat1 hh(hidSize); public NslDoutFloat2 wo(hidSize, outSize); public NslDoutFloat1 ho(outSize); public NslDoutFloat1 yh(hidSize); public NslDoutFloat1 yo(outSize);

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 12 Network 2 public Error error(outSize); public Update update(inSize,hidSize,outSize); private void forward() { yh = nslSigmoid(x*wh + hh); yo = yh*wo + ho; } public void initTrainEpoch() { wh = nslRandom(wh,(float)-0.5,(float)0.5); hh = nslRandom(hh,(float)-0.5,(float)0.5); wo = nslRandom(wo,(float)-0.5,(float)0.5); ho = nslRandom(ho,(float)-0.5,(float)0.5); }

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 13 Network 3 public void makeConn() { nslRelabel(this.yo, error.yo); nslRelabel(this.t, error.t); nslRelabel(this.x, update.x); nslRelabel(this.yh, update.yh); nslRelabel(this.wh, update.wh); nslRelabel(this.hh, update.hh); nslRelabel(this.wo, update.wo); nslRelabel(this.ho, update.ho); nslConnect(error.err, update.deltaOut); } public void simRun() { forward(); } public void simTrain() { forward(); } }

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 14 Error nslImport nslAllImports; nslModule Error (int outSize) { public NslDinFloat1 yo(outSize); public NslDinFloat1 t(outSize); public NslDoutFloat1 err(outSize); private NslFloat0 epsilon(); public NslFloat0 tss(); public void initTrain() { tss = 0.0; }

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 15 Error 2 public void simTrain() { err = yo - t; tss = tss + nslSum(err ^ err); } public void endTrain() { if (tss < epsilon) { nslPrintln("Convergence"); verbatim_NSLJ; system.getScheduler().breakCycles(); system.continueCmd(); verbatim_off; }

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 16 Update nslImport nslAllImports; nslModule Update (int inSize, int hidSize, int outSize) { public NslDinFloat1 deltaOut(outSize); public NslDinFloat1 x(inSize); public NslDinFloat1 yh(hidSize); public NslDoutFloat2 wh(inSize, hidSize); public NslDoutFloat1 hh(hidSize); public NslDoutFloat2 wo(hidSize, outSize); public NslDoutFloat1 ho(outSize); private NslFloat1 deltaHid(hidSize); private NslFloat0 lrate();

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 17 Update 2 public void backward() { deltaHid = nslElemMult(yh ^ ((float)1.0 - yh), nslProd(deltaOut,nslTrans(wo))); ho = ho - (lrate ^ deltaOut); wo = wo - nslProd(nslTrans(yh),(lrate ^ deltaOut)); hh = hh - (lrate ^ deltaHid); wh = wh - nslProd(nslTrans(x),nslElemMult(lrate, deltaHid)); } public void simTrain() { backward (); }

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 18 DisplayResults nslImport nslAllImports; nslOutModule DisplayResult (int inSize, int outSize) { private NslFloat1 in(inSize); private NslFloat1 outTemp(outSize); private NslFloat0 out(); public void initModule() { nslAddAreaCanvas(in,0,1); nslAddAreaCanvas(out,0,1); } private void updateValues() { in = (NslFloat1)nslGetValue("backPropModel.network.x"); outTemp = (NslFloat1)nslGetValue("backPropModel.network.yo"); out = outTemp[0]; } public void simTrain() { updateValues(); } public void simRun() { updateValues();} }

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 19 The Exclusive-Or -- XOR Input Output is not linearly separable Opening the BackProp Model script file for training

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 20 Simulation Control Before doing any training the simulator executes the system initialization initSys. We then execute the backprop model train script and, when the learning process finishes, we execute the running script to test the network against new vectors. The training phase: We set trainEndTime to the number of training patterns specified by nPats and trainDelta to 1.0 in order to have as many training steps as there are training patterns. An epoch corresponds to a single pass over all patterns. We set trainEpochSteps to 1000 telling the system to train almost indefinitely until some suitable ending makes it stop, in this case that the error is small enough. We use epsilon as parameter to decide when learning should stop. The training phase: We set runEndTime to 1.0 and runDelta to 1.0.

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 21 Visualization The input to the network is set to "0 0". After the network has been run the output becomes 0, as expected.

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 22 Training script nsl set backPropModel.train.patterns { { 0 0 } { 0 1 } { 1 0 } { 1 1 } } nsl set backPropModel.train.outputs { { 0 } { 1 } { 1 } { 0 } } nsl set system.numTrainEpochs 1000 nsl set backPropModel.network.error.epsilon nsl set backPropModel.network.update.lrate 0.8 nsl doTrainEpochTimes

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 23 Parameter Assignment We set epsilon to a number specifying that we have reached a small enough error for the network to obtain acceptable solutions such as 0.1, 10% of the output value,  nsl set backPropModel.network.error.epsilon 0.1 The learning parameter  is represented by the lRate parameter determining how big a step the network can take in correcting errors. The learning rate for this problem was set to 0.8 for both the hidden and output layers.  nsl set backPropModel.network.update.lRate 0.8 The training rate is typically set between 0.01 to 1.0: If the training step is too large - close to 1 - the network tends to oscillate and will likely jump over the minimum. If the training step is too small - close to 0 - it will require many cycles to complete the training, although it should eventually learn.

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 24 Running Script for { set i 0 } { $i < 2 } {incr i} { for { set j 0 } { $j < 2 } {incr j} { set x [list $i $j] nsl set backPropModel.network.x $x nsl initRun nsl simRun nsl endRun puts "For { $i $j } the output is { [nsl get backPropModel.network.yo] } " }

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 25 Homework #2 Self-Organization of the FARS Visual System u X: is the visual input [shape, color, width, height] u Z: is the identity of the object u Y1: is AIP’s grasp preference [side, power, precision, with aperture coding] u Y2: is RX’s grasp preference [side, power, precision, with aperture coding] u G: is the final grasp command [side, power, precision, with aperture coding] u WTA: is winner take all network (can be implemented non-neurally as well)  RX: is an unspecified region to be implemented as a backprop network similar to IT and AIP. AIP RX y1 x IT z WTA g y2

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 26 Adding Protocols public void initModule(){ … nslDeclareProtocol("basic", "Basic on/off"); nslDeclareProtocol("transfer", "Overarm/Underarm transfer"); nslDeclareProtocol("calibration", "Two gaze-throw calibrations"); system.addProtocolToAll("basic"); system.addProtocolToAll("transfer"); system.addProtocolToAll("calibration"); } public void basicProtocol() { nslPrintln("Basic on/off protocol selected"); protocol = 0; }

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 27 Adding Protocols 3  public void addProtocol(String name, NslModule module)  public String nslGetProtocol()  public void nslSetProtocol(String name)

Michael Arbib CS564 - Brain Theory and Artificial Intelligence, USC, Fall Lecture 16. NSLJ Backprop 28 Adding Protocols 2 public void initTrainEpoch() { nslRemoveFromLocalProtocols("manual"); nslRemoveFromLocalProtocols("basic"); nslRemoveFromLocalProtocols("transfer"); nslRemoveFromLocalProtocols("calibration"); } public void initRunEpoch() { nslAddProtocolRecursiveUp("basic"); nslAddProtocolRecursiveUp("transfer"); nslAddProtocolRecursiveUp("calibration"); }