840 likes | 1.17k Views
Computacion inteligente. The perceptron. Agenda. History Perceptron structure Perceptron as a two-class classifier The Perceptron as a Logic Operator Perceptron Learning Perceptron Convergence Theorem Examples Perceptron Limitation. History. History.
E N D
Computacion inteligente The perceptron
Agenda • History • Perceptron structure • Perceptron as a two-class classifier • The Perceptron as a Logic Operator • Perceptron Learning • Perceptron Convergence Theorem • Examples • Perceptron Limitation
History • 1943 The perceptron was derived from a biological brain neuron model introduced by Mc Culloch & Pitts • Artificial neural networks in principle could compute any arithmetic and logical functions. • McCulloch and Pitts network cannot learn. • 1949 Hebb proposed a learning law that explained how a network of neurons learned
History • 1957 Rosenblatt developed Perceptron, a hardware neural net for character recognition • Rosenblatt designed the perceptron with a view toward explaining & modeling pattern recognition abilities of biological visual systems • 1958 Rosenblatt was credited with the perceptron learni learning algorithm
Rosenblatt’s elementary perceptron • A two-class problem that consists of determining whether the input pattern is a “p” or not
History • 1969Minsky & Papert - perceptron limitation • Famous “XOR” problem • Death of ANN • 1974-1986 Various people solve the problems with perceptrons: • Algorithms for training feedforward multilayered perceptrons • Error Back Propagation (Rumelhart et al 1986) • Re-emergence of ANN
Perceptron structure • Input patterns represented by vector x • wiis a modifiable weight associated with an incoming signal xi • The weighted sum of the inputs is applied to the hard limiter, with a threshold value b The threshold b = w0 can be viewed as the connection weight between the output unit and a dummy incoming signal x0 = 1
Perceptron structure • The weighted sum of the inputs is applied to the hard limiter, which produces an output equal to +1 if its input is positive, and -1 if it is negative. • the hard limiteris
Perceptron structure • the hard limitercan be • sgn(x): a sign function, or, hardlims(x) • step(x): a step function, or, hardlim(x) Matlab toolbox
Perceptron mathematical model • Neuron output • Vector form b included
Perceptron as a two-class classifier • The aim of the perceptron is to classify inputs, x1, x2, . . ., xn, into one of two classes, say A1 and A2. • The input patterns belong to one of two classes. This can only happen when they are linearly separable
Two-input perceptron • The decisionboundary is determined by
x2 x1 Example of Perceptron Decision Boundary w = (w1, w2, b) = (1, -1, 0)
x2 x1 Example of Perceptron Decision Boundary w = (w1, w2, b) = (1, -1, 0) wT. x = 0 => 1. x1 - 1. x2 + 0.1 = 0 => x1 - x2 = 0 => x1 = x2
x2 x1 Example of Perceptron Decision Boundary w = (w1, w2, b) = (1, -1, 0) wT. x = 0 => 1. x1 - 1. x2 + 0.1 = 0 => x1 - x2 = 0 => x1 = x2 This is the equation for the decision boundary
wT. x = 0 x2 x1 Example of Perceptron Decision Boundary w = (w1, w2, b) = (1, -1, 0) This is the equation for decision region -1 wT. x < 0 => x1 - x2 < 0 => x1 < x2
wT. x = 0 x2 x1 Example of Perceptron Decision Boundary w = (w1, w2, b) = (1, -1, 0) wT. x > 0 => x1 - x2 > 0 => x1 > x2 This is the equation for decision region +1
Example • Decision Boundary for
Three-input perceptron • The decisionboundary is determined by
n-input perceptron • In the case of an elementary perceptron, the n-dimensional space is divided by a hyperplane into two decision regions. • The hyperplane is defined by the linearlyseparable function:
Example Matrix with 64 inputs shown
x 2 1 0 0 x Truth Table for Logical AND 1 0 1 0 1 x y x & y 0 0 0 1 1 0 1 1 output inputs The Perceptron as a Logic Operator • The Perceptron as a Logic AND
x +2 if sum < 0 : 0 else : 1 y +2 2x+3y-3 0 1 -3 0 Truth Table for Logical AND 0 1 sum output inputs weights x y x & y 0 0 0 1 1 0 1 1 output inputs The Perceptron as a Logic AND
x 2 1 x Truth Table for Logical OR 1 0 1 x y x | y 0 0 0 1 0 1 1 1 0 1 1 1 output inputs The Perceptron as a Logic Operator • The Perceptron as a Logic OR
x +2 if sum < 0 : 0 else : 1 y +2 2x+2y-1 1 -1 Truth Table for Logical OR sum output inputs weights x y x | y 0 0 0 1 0 1 1 1 0 1 1 1 output inputs The Perceptron as a Logic OR
The Perceptron as a Logic Operator • Exercise • Show that a perceptron neuron with the followings weights and bias implements the OR gate
Learning in natural neural networks • At the neural level the learning happens by • Changing of the synaptic strengths, • Eliminating some synapses, and building new ones. • This procedure is called the Learning rule
Learning in artificial neural networks • By learning rule we mean a procedure for modifying the weights and biases of a network. • The purpose of the learning rule is to train the network to perform some task. This procedure may also referred to as a training algorithm.
Learning Paradigms • Supervised learning • Unsupervised learning • Reinforcement learning • Classification • Control • Function approximation • Associative memory • Clustering • Control
Supervised Learning • The learning rule is provided with • a set of examples (the training set) of proper network behavior xk :Input to the network tk : Correct (target) output
Supervised Learning • As the inputs are applied to the network, the network outputs are compared to the targets ak :Output of the network tk :correct (target) output
Supervised Learning • The learning rule is then used to adjust the weights and biases of the network in order to move the network outputs closer to the targets. • wnew: Updated Weights • wold: Initial weights weights adjusted according to error
Supervised Learning weights adjusted according to error
Perceptron Training • How can we train a perceptron for a classification task? • We try to find suitable values for the weights in such a way that the training examples are correctly classified. • Geometrically, we try to find a hyper-plane that separates the examples of the two classes
Perceptron Training • Rosenblatt (1958) devised a learning algorithm for artificial neurons • start with a training set (example inputs & corresponding desired outputs) • train the network to recognize the examples in the training set (by adjusting the weights on the connections) • once trained, the network can be applied to new examples
Perceptron learning algorithm • Set the weights on the connections with random values. • Iterate through the training set, comparing the output of the network with the desired output for each example. • If all the examples were handled correctly, then DONE. • Otherwise, update the weights for each incorrect example: If output = -1 but should be 1 If output = 1 but should be -1 • GO TO 2
Variables and parameters • Training setS of examples {x,t} • x is an input vector and • t the desired target vector • Example: Logical AND • S = {(0,0),0}, {(0,1),0}, {(1,0),0}, {(1,1),1}
Variables and parameters • Variables and parameters at iteration k of the learning algorithm: • Input vector: x(k) = [+1, x1(k), x2(k), …, xm(k)]T • Weight vector: w(k) = [b(k), w1(k), w2(k), …, wm(k)]T • Bias: b(k) • Actual response: y(k) • Desired response: t(k) • Learning rate parameter: > 0
Perceptron Learning Rule • If at iteration k, the actual output is y(k) and the desired output is t(k), then the error is given by: • wherek = 1, 2, 3, . . . • Iteration k here refers to the k-th training example presented to the perceptron.
Perceptron Learning Rule • Perceptron Learning Rule • If the error, e(k), is positive, we need to increase perceptron output y(k), but if it is negative, we need to decrease y(k).
Perceptron’s training algorithm • Step 1: Initialisation • Set initial weights w1, w2,…, wm and threshold b to random numbers. • Step 2: Activation • Activate the perceptron by applying inputs x1(k), x2(k),…, xm(k). Calculate the actual output at iteration k = 1
Perceptron’s training algorithm • Step 3: Weight training • Update the weights of the perceptron • Step 4: Iteration • Increase iteration k by one, go back to Step 2 and repeat the process until convergence.
Perceptron Convergence Theorem • The perceptron learning algorithm will always find weights to classify the inputs if such a set of weights exists. Minsky & Papert showed such weights exist if and only if the problem is linearly separable key reason for interest in perceptrons