Package src :: Package stats306b :: Package lecture4 :: Module kernel
[hide private]
[frames] | no frames]

Module kernel

source code

This module describes how to use the 'kernel' trick for nonparametric regression. Kernels used are: Gaussian, piecewise linear, polynomial.

Functions [hide private]
 
plinear(x, y)
Piecewise linear kernel:
source code
 
polynomial(x, y, order=1)
Polynomial kernel
source code
 
gaussian(x, y, sigma=1.0)
Gaussian kernel with a given sigma.
source code
Function Details [hide private]

plinear(x, y)

source code 

Piecewise linear kernel:

K(x,y) = min(x,y)

x, y must be non-negative, and have the shape (q,1) for some q

polynomial(x, y, order=1)

source code 

Polynomial kernel

(dot(x,y))**order

x, y are p-vectors and must have the shape (q,p) for some q

gaussian(x, y, sigma=1.0)

source code 

Gaussian kernel with a given sigma.

K(x,y)=exp(-(x-y)**2/(2*sigma**2))

x, y are p-vectors and must have the shape (q,p) for some q