Monthly Archives: February 2014

Gaussian kernel regression with Matlab code (Gaussian Kernel or RBF Smoother)

Gaussian kernel regression with Matlab code

In this article, I will explain Gaussian Kernel Regression (or Gaussian Kernel Smoother, or Gaussian Kernel-based linear regression, RBF kernel regression)  algorithm. Plus I will share my Matlab code for this algorithm. 

If you already know the theory. Just download  from here.  <Download>

You can see how to use this function from the below. It is super easy.

main figure

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

From here, I will explain the theory.

Basically, this algorithm is a kernel based linear smoother algorithm and just the kernel is the Gaussian kernel. With this smoothing method, we can find a nonlinear regression function.

The linear smoother is expressed with the below equation

y^* = \frac{\sum^N_{i=1}K(x^*,x_i)y_i}{\sum^N_{i=1}K(x^*,x_i)}

here x_i is the i_th training data input, y_i is the i_th training data output, K is a kernel function. x^* is a query point, y^* is the predicted output.

In this algorithm, we use the Gaussian Kernel which is expressed with the below equation. Another name of this functions is Radial Basis Function (RBF) because it is not exactly same with the Gaussian function.

K(x^*,x_i)=\exp\left(-\frac{ (x^*-x_i)^2}{2b^2}\right)

With these equation, we can smooth the training data outputs, thus we can find a regression function.

This program <Download> was made for one-dimensional inputs. If you need multi-dimension, please leave a reply, see this article. I recently made a new version for multidimensional input.

For the optimization of kernel bandwidth, see my other article <Link>.

 

Then good luck.

 

-Mok-

—————————————————————————————————————————–

I am Youngmok Yun, and writing about robotics theories and my research.

My main site is http://youngmok.com, and Korean ver. is  http://yunyoungmok.tistory.com.

—————————————————————————————————————————–

Control engineer’s one-year observation of my baby

As a control engineer, I see different features from my one year old baby, Chloe. When she was first born, she did not have a model for her biomechanical system, and the controller in her brain was immature. Nonetheless, her finger did not vibrate or diverge. The kinematics of her finger is same with that of a three-link pendulum, commonly referred to describe a chaotic dynamic system. She had never tried to make it stable, no, actually she disturbed the system. But, her biomechanical systems were amazingly stable. For the last one year, her control ability has been dramatically improved. Now she can walk and interact with highly uncertain dynamic objects like another baby. It is an extremely difficult control task. Furthermore, in someday, she would be able to drive a car and to manage (control) a business. She has a great system, modeling ability, and controller, three essential elements for control. As a control engineer, I cannot help being surprised and admiring.

 

Feb 11, 2014

-Mok-