Docsity

Linear Methods and Support Vector Machines: Handling Non-Binary Data and Nonlinear Data, Study notes of Programming Languages

Partial preview of the text

Download Linear Methods and Support Vector Machines: Handling Non-Binary Data and Nonlinear Data and more Study notes Programming Languages in PDF only on Docsity!

Linear Methods,

cont’d; SVMs intro

Straw poll

Which would you rather do first?

Unsupervised learning

Clustering

Structure of data

Scientific discovery (genomics, taxonomy, etc.)

Reinforcement learning

Control

Robot navigation

Learning behavior

Reminder...

Derive the vector derivative expressions:

Find an expression for the minimum squared error weight vector, w , in the loss function:

∂x

x

T

A = A

∂x

x

T

= I

L

2

(w, X, Y ) = (Y − X

′T^

w)

T

(Y − X

′T^

w)

∂x

x

T

Ax = (A + A

T

)X

Solution to LSE regression

Differentiating the loss function...

L

2

(w, X, Y ) = (Y − X

′T^

w)

T

(Y − X

′T^

w)

= (Y

T

− w

T

X

′

)(Y − X

′T^

w)

= Y

T

Y − w

T

X

′

Y − Y

T

X

T

w + w

T

X

′

X

′T^

w

∂w

L 2 (w) = −X

′

Y − (Y

T

X

′T^

T

+ 2X

′

X

′T^

w

⇒ w = (X

′

X

′T^

− 1

X

′

Y

= − 2 X

′

Y + 2X

′

X

′T^

w

Handling non-binary data

DTs and k -NN can handle multi-class data

Linear discriminants (& many other) learners only work on binary

3 ways to “hack” binary classifiers to p -ary data:

1 against many:

Train p classifiers to recognize “class 1 vs anything else”; “class 2 vs everything else” ...

Cheap, easy

May drastically unbalance the classes for each classifier

What if two classifiers make diff predictions?

Multiclass trouble

Handling non-binary data

Coding theory approach

Given p classes, choose b ≥lg( p )

Assign each class a b -bit “code word”

Train one classifier for each bit

Apply each classifier to a test instance => new code => reconstruct class x1 x2 x3 y green 3.2 -9 apple yellow 1.8 0.7 lemon yellow 6.9 -3 banana red 0.8 0.8 grape green 3.4 0.9 pear x1 x2 x3 y1 y2 y green 3.2 -9 0 0 0 yellow 1.8 0.7 0 0 1 yellow 6.9 -3 0 1 0 red 0.8 0.8 0 1 1 green 3.4 0.9 1 0 0

Support Vector

Machines

Linearly nonseparable data

2 possibilities:

Use nonlinear separators (diff hypothesis space)

Possibly intersection of multiple linear separators, etc. (E.g., decision tree) ! 3! 2! 1 0 1 2 3 ! 3 ! 2 ! 1 0 1 2 3

Linearly nonseparable data

2 possibilities:

Use nonlinear separators (diff hypothesis space)

Possibly intersection of multiple linear separators, etc. (E.g., decision tree)

Change the data

Nonlinear projection of data

These turn out to be flip sides of each other

Easier to think about (do math for) 1st case

Common projections

Degree- k polynomials:

Fourier expansions:

φ(x 1 ,... , xd ) = (x

k 1

, x

k− 1 1

x 2 , x

k− 2 1

x 2 x 3 ,... , x

k d

sin(xd ), sin(2xd ),.. .)

sin(x 1 ), sin(2x 1 ),...

cos(x 2 ), cos(2x 2 ),...

φ(x 1 ,... , xd ) = (

, cos(x 1 ), cos(2x 1 ),...

Example nonlinear surfaces

Quad. polynomial, C = 10 Quad. SVM images from lecture notes by S. Dreiseitl

Example nonlinear surfaces

= 10 deg. 4 polynomial, C = 10 SVM images from lecture notes by S. Dreiseitl

Example nonlinear surfaces

Gaussian, σ = 1 Text SVM images from lecture notes by S. Dreiseitl