Download presentation
Presentation is loading. Please wait.
Published byFrancis Oliver Modified over 9 years ago
1
Linear Discrimination Reading: Chapter 2 of textbook
2
Framework Assume our data consists of instances x = (x 1, x 2,..., x n ) Assume data can be separated into two classes, positive and negative, by a linear decision surface. Learning: Assuming data is n-dimensional, learn (n−1)- dimensional hyperplane to classify the data into classes.
3
Linear Discriminant Feature 1 Feature 2
4
Linear Discriminant Feature 2 Feature 1
5
Linear Discriminant Feature 2 Feature 1
6
Example where line won’t work? Feature 2 Feature 1
7
Perceptrons Discriminant function: w 0 is called the “bias”. −w 0 is called the “threshold” Classification:
8
Perceptrons as simple neural networks...... w1w1 w2w2 wnwn o w0w0 +1 x1x1 x2x2 xnxn
9
Example What is the class y?.4 -.4 -.1 +1 1
10
Geometry of the perceptron Feature 1 Feature 2 Hyperplane In 2d:
11
Work with one neighbor on this: (a) Find weights for a perceptron that separates “true” and “false” in x 1 x 2. Find the slope and intercept, and sketch the separation line defined by this discriminant. (b) Do the same, but for x 1 x 2. (c) What (if anything) might make one separation line better than another? In-class exercise
12
To simplify notation, assume a “dummy” coordinate (or attribute) x 0 = 1. Then we can write: We can generalize the perceptron to cases where we project data points x n into “feature space”, (x n ):
13
Notation Let S = {(x k, t k ): k = 1, 2,..., m} be a training set. Note: x k is a vector of inputs, and t k is {+1, −1} for binary classification, t k for regression. Output o: Error of a perceptron on a single training example, (x k,t k )
14
Example S = {((0,0), -1), ((0,1), 1)} Let w = {w 0, w 1, w 2 ) = {0.1, 0.1, −0.3} o What is E 1 ? What is E 2 ? +1 x1x1 0.1 x2x2 −0.3
15
How do we train a perceptron? Gradient descent in weight space From T. M. Mitchell, Machine Learning
16
Perceptron learning algorithm Start with random weights w = (w 1, w 2,..., w n ). Do gradient descent in weight space, in order to minimize error E: –Given error E, want to modify weights w so as to take a step in direction of steepest descent.
17
Gradient descent We want to find w so as to minimize sum-squared error: To minimize, take the derivative of E(w) with respect to w. A vector derivative is called a “gradient”: E(w)
18
Here is how we change each weight: and is the learning rate.
19
Error function has to be differentiable, so output function o also has to be differentiable.
20
1 activation output 0 1 activation output 0 Activation functions Not differentiableDifferentiable
21
This is called the perceptron learning rule, with “true gradient descent”.
22
Problem with true gradient descent: Search process will land in local optimum. Common approach to this: use stochastic gradient descent: –Instead of doing weight update after all training examples have been processed, do weight update after each training example has been processed (i.e., perceptron output has been calculated). –Stochastic gradient descent approximates true gradient descent increasingly well as 1/ .
23
Training a perceptron 1.Start with random weights, w = (w 1, w 2,..., w n ). 2.Select training example (x k, t k ). 3.Run the perceptron with input x k and weights w to obtain o. 4.Let be the learning rate (a user-set parameter). Now, 5.Go to 2.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.