Docsity

Instance-Based Learning: Locally Weighted Regression and Radial Basis Functions - Prof. Gr, Study notes of Computer Science

Partial preview of the text

Download Instance-Based Learning: Locally Weighted Regression and Radial Basis Functions - Prof. Gr and more Study notes Computer Science in PDF only on Docsity!

Intro. to machine learning (CSI 5325)

Lecture 20: Instance-based learning

Greg Hamerly

Spring 2008

Some content from Tom Mitchell.

Outline

1 Locally weighted regression

2 Radial basis functions

3 Learning linear functions

4 Case-based reasoning

5 Lazy and eager learning

Locally weighted regression

Locally Weighted Regression (2)

Several options of error functions: Squared error over k nearest neighbors (in N(xq , k))

E 1 (xq ) ≡

x∈N(xq ,k)

(f (x) − ˆf (x))^2

Distance-weighted squared error over all neighbors

E 2 (xq ) ≡

x∈D

(f (x) − ˆf (x))^2 K (d(xq , x))

Combination of the two (kernel-weighted over k neighbors)

Radial basis functions

Radial Basis Function Networks

Global approximation to target function, in terms of linear combination of local approximations Used, e.g., for image classification A different kind of neural network Closely related to distance-weighted regression, but “eager” instead of “lazy”

Radial basis functions

Training Radial Basis Function Networks

Q1: What xu to use for each kernel function Ku (d(xu , x)) Scatter uniformly throughout instance space Or use training instances (reflects instance distribution) Or use the means of clusters (found by k-means, Gaussian EM, etc.)

Q2: How to train weights (assume here Gaussian Ku ) First choose variance (and perhaps mean) for each Ku e.g., use EM Then hold Ku fixed, and train linear output layer efficient methods to fit linear function

Learning linear functions

Methods for learning linear functions

Consider a linear function of x, where x 0 = 1:

f (x) = w 0 x 0 + w 1 x 1 + w 2 x 2 +... + wd xd

Mitchell has discussed several methods for learning the weights of a linear function based on gradient descent.

However, if we assume a squared error function:

E (ˆf ) =

∑^ n

i=

(f (xi ) − ˆf (xi ))^2

then much more efficient training methods exist.

Learning linear functions

Deriving linear weights

Take the derivative of E with respect to the weights:

E (ˆf ) =

(Xw − y )T^ (Xw − y ) ∂E ∂w = (X T^ )(Xw − y ) = X T^ Xw − X T^ y Setting this equal to zero to find the minimum value: X T^ Xw − X T^ y = 0 X T^ Xw = X T^ y (X T^ X )−^1 X T^ Xw = (X T^ X )−^1 X T^ y w ˆ = (X T^ X )−^1 X T^ y Easily computed in any numerical package (e.g. Matlab), with the majority of the cost being a (d + 1) × (d + 1) matrix inversion. (^) 10 / 16

Learning linear functions

General applicability of linear models

Linear models are extremely popular because: they can be solved efficiently (see previous slides) represent more complex functions through ‘basis expansions’ construct a linear combination of nonlinear features

Many machine learning algorithms are related to some sort of linear model: linear output perceptron (without thresholding) radial basis network locally weighted regression non-linear (e.g. polynomial) regression support vector machines etc.

Case-based reasoning

Case-Based Reasoning in CADET

CADET: 75 stored examples of mechanical devices each training example: 〈 qualitative function, mechanical structure〉 new query: desired function, target value: mechanical structure for this function Distance metric: match qualitative function descriptions

Case-based reasoning

Case-Based Reasoning in CADET

A stored case:

_+

+_

Function:

T−junction pipe

T Q

= temperature = waterflow

Structure:

_+

+_

+^ −

Structure: Function:

A problem specification: (^) Water faucet

Q ,T 1

2

1

Q ,T Q ,T 2

3 3

Q Q T T

Q

T

1 2 1 2 3

3

C C

t f

Q

T

c

c

Q

T

h

h

Q

T

m

m

Lazy and eager learning

Lazy and Eager Learning

Lazy: wait for query before generalizing k-Nearest Neighbor, Case based reasoning

Eager: generalize before seeing query Radial basis function networks, ID3, Backpropagation, NaiveBayes,... Does it matter? Eager learner must create global approximation Lazy learner can create many local approximations if they use same H, lazy can represent more complex functions (e.g., consider H = linear functions)