39
Math Primer

Math Primer

  • Upload
    elwyn

  • View
    35

  • Download
    0

Embed Size (px)

DESCRIPTION

Math Primer. Outline. Calculus: derivatives, chain rule, gradient descent, taylor expansions Bayes Rule Fourier Transform Dynamical linear systems. Calculus. Derivatives Derivative=slope. Calculus. Derivative: a few common functions (x n )’=nx n-1 (x -1 )’=-1/x 2 = x -2 - PowerPoint PPT Presentation

Citation preview

Page 1: Math Primer

Math Primer

Page 2: Math Primer

Outline

• Calculus: derivatives, chain rule, gradient descent, taylor expansions

• Bayes Rule

• Fourier Transform

• Dynamical linear systems

Page 3: Math Primer

Calculus

• Derivatives

• Derivative=slope

0 0

lim limx x

y f x

dyf x

dxf x x f xy

x x

Page 4: Math Primer

Calculus

• Derivative: a few common functions

• (xn)’=nxn-1

• (x-1)’=-1/x2 = x-2

• exp(x)’=exp(x)

• log(x)’=1/x

• cos(x)’=-sin(x)

Page 5: Math Primer

Calculus

• Derivative: Chain rule

• Ex: gaussian• z=h(x)=exp(-x2)’,f(y)=exp(y), y=g(x)=-x2

• f’(y)=exp(y)= exp(-x2), g’(x)=-2x• z’= f’(y)g’(x) =exp(-x2)(-2x)

' '

z f y f g x h x

dz dz dyh x f y g x

dx dy dx

Page 6: Math Primer

Calculus

• Finding minima: gradient descent

f(x) f’(x0) < 0

x0 x*x0+x

x > 0f’(x*)=0

x = -f’(x0)

Page 7: Math Primer

Calculus

• Example: minimizing an error function

22

22

* *

* *

2 * '

i ii

i i i ij ji i j

ij

k kk l

kl k k kl

E y y v h y

v g net y v g w a y

h w

E E y h nety y v g a

w y h net w

Page 8: Math Primer

Calculus

• Taylor expansion

0 00

0 0 0

20 0 0 0

1

2

f x x f xf x

xf x x f x f x x

f x x f x f x x f x x

Page 9: Math Primer

Calculus

1 21 2

1

21 2

2 2 2 22 2

0 1 2 1 2 2 12 21 2 1 2 2 1

2 2

21

0

1

2

1

2

T

T

T T

f ff f x x

x x

xf ff

xx x

f f

f f f ff x f x x x x x x

x x x x x x

f f

xf x f

o o

o o

o o o o

o

0 0

x x

0

x x

0 0

0

x x x x

x

0

x δx x

x

x x δx

x δx

x δx δx

1 2

2 2

22 1 2

0

1

2

T T

x x

f f

x x x

f x f

o

o o

x

x x

0 0

δx

x δx δx H x δx

Page 10: Math Primer

Bayes rule

• Example: drawing from 2 boxes• 2 boxes (B1,B2)• P(B1)=0.2,P(B2)=0.8 (Prior)

• Balls with two colors (R,G)• B1=(16R,8G), B2=(8R,16G)• P(R|B1)=2/3, P(G|B1)=1/3 (Conditional)• P(R|B2)=1/3, P(G|B2)=2/3 (Conditional)

Page 11: Math Primer

Bayes rule

• Joint distributions

• P(G,B1)=P(B1)P(G|B1)=0.2*0.33=0.066

• P(G,B2)=P(B2)P(G|B2)=0.8*0.66=0.528

• P(X,Y)=P(X|Y)P(Y)

• P(Y,X)=P(Y|X)P(X)

• P(Y|X)P(X)=P(X|Y)P(Y)

Page 12: Math Primer

Bayes rule

• Bayes rule

• P(Y|X)P(X)=P(X|Y)P(Y)

• P(Y|X)=P(X|Y)P(Y)/P(X)

• If you draw G, what is the probability that it came from box1?

• P(B1|G)=P(G|B1)P(B1)/P(G)

How do you get this? Marginalize

Page 13: Math Primer

Bayes rule

Marginalization

• P(G)=P(G,B1)+P(G,B2)=0.066+0.528=0.6

• P(G)=P(G|B1)P(B1)+P(G|B2)P(B2)

• P(Y)=x P(Y,X)

• P(Y)=x P(Y|X)P(X)

• P(Y|X)=P(X|Y)P(Y)/YP(X|Y)P(Y)

Page 14: Math Primer

Bayes rule

• Bayes rule

• If you draw G, what is the probability that it came from Box1 or Box2?

• P(B1|G)=P(G|B1)P(B1)/P(G)

=(0.33*0.2)/0.6=0.11

• P(B2|G)=P(G|B2)P(B2)/P(G)

=(0.66*0.8)/0.6=0.89

Sum to one

Page 15: Math Primer

Bayes rule

• P(A,B|C)=P(A|B,C)P(B|C)

• P(B|A,C)=P(A|B,C)P(B|C)/P(A|C)

Page 16: Math Primer

Fourier transform

• Basis in linear algebra

• Basis function: dirac

• Basis function: sin

Page 17: Math Primer

Fourier Transform

• Decomposition in sum of sin and cosine

• Power: first term is the DC

• Phase

• Fourier transform for

Dirac

Sin

Gaussian (inverse relationship)

Page 18: Math Primer

Fourier Transform

• Convolution and products

Page 19: Math Primer

Fourier transform

• Fourier transform of a Gabor

Page 20: Math Primer

Fourier transform

• Eigenspace for liner dynamical system…

Page 21: Math Primer

Dynamical systems

• Stable if <0, unstable otherwise

0 exp

x x

x t x t

Page 22: Math Primer

Dynamical systems

0

0

if 0

let

then

o

o o

o

x f x

f x

x x x

x x

x f x x

x f x f x x

x f x x

Fixed Point

Page 23: Math Primer

Dynamical systems

ox f x x

Stable if f’(x0)<0, unstable otherwise.

Page 24: Math Primer

Dynamical systems

x F x

1 1 2

2 1 2

,

,

f x x

f x x

F x

Page 25: Math Primer

Dynamical systems

0 0

0

1 0 1 0

1 21 1

2 22 0 2 0

1 2

1 0 1 01 1 2

1 2

f f

x xx x

x xf f

x x

f fx x x

x x

x F x F x x

F x x J x

x x

x x

x x

1 0 1 0

1 2

2 0 2 0

1 2

f f

x x

f f

x x

x x

Jx x

Page 26: Math Primer

Dynamical systems

• go into eigen space• Equations decouple

1 1 1 2 2 2

1

1

1 1 1

1 1 1

,

0 exp

if x

x

x x

x t x t

Je e Je e

x e

x J e

e e

e e

Stable if <0, unstable otherwise.

Page 27: Math Primer

Dynamical systems

1 0 1 0

1 21 1

2 22 0 2 0

1 2

1 11

2 2

1 1 11

2 2 2

1 11

2 22

1 1 1

0

0

0

0

0

0e e

e e

e e

f f

x xx x

x xf f

x x

x

x

x x

x x

x x

x x

x x

x x

x x

P Ρ

Ρ ΡP Ρ

2 2 2e ex x

1

11

2

11 2112

12 22

0

0

e e

e e

1

J P ΛΡ

P Ρ

P e e

Page 28: Math Primer

Dynamical systems

• go into eigen space• Equations decouple

1 1 1 2 2 2

1 1 2 2

1 1 1 2 2 2

1 1 2 2

,

exp exp

x x

x x

t t t

Je e Je e

x J e e

x e e

x e e

Page 29: Math Primer

Dynamical systems

• go into eigen space• Equations decouple

1 1 1

2 2 2

0

0

e e

e e

Stable is f’(x0)<0, unstable otherwise.

Page 30: Math Primer

Dynamical systems

• Fixed point• Saddle point• Unstable point• Stable and unstable

oscillations: complex eigenvalues

1 1 1

2 2 2

0

0

e e

e e

Page 31: Math Primer

Nonlinear Networks

• Discrete case:

Stable if ||<1, unstable otherwise

1

1

0t

x t x t

x t x

Page 32: Math Primer

Nonlinear Networks

• Discrete case:

1

1

1

1

1

1

H( )

H

H( )

i

n

ij jj

t t

t t

t t

t t

o t h w o t

O WO

O O W O O

O O WO J O

O J O

Page 33: Math Primer

Nonlinear Networks

• Dynamics around attractor:

1

1

1

0 0

0 ... 0

0 0

t t

n

t t

-1

O J O

J = P ΛP

Λ

P O ΛP O

Page 34: Math Primer

Nonlinear Networks

• Stable Fixed point: |1|<1, |2|<1

Page 35: Math Primer

Nonlinear Networks

• Saddle Point: |1|>1, |2|<1

Page 36: Math Primer

Nonlinear Networks

• Unstable Fixed point: |1|>1, |2|>1

Page 37: Math Primer

Nonlinear Networks

• Line Attractor: 1=1, |2|<1

Page 38: Math Primer

Nonlinear Networks

• Oscillation: complex ’s

Page 39: Math Primer

Nonlinear Networks: global stability

• Lyapunov Function: function of the state of the system which is bounded below and goes down over time. If such a function exists, the system is globally stable.

• Ex: Hopfield network, Cohen-Grossberg network