Home

Awesome

Kernel Adaptive Filtering Toolbox

A Matlab benchmarking toolbox for kernel adaptive filtering.

Kernel adaptive filters are online machine learning algorithms based on kernel methods. Typical applications include time-series prediction, nonlinear adaptive filtering, tracking and online learning for nonlinear regression. This toolbox includes algorithms, demos, and tools to compare their performance.

<p align="center"> <img src="doc/kaf_diagram.png" width="60%"> <div align="center"><i>Nonlinear system identification using kernel adaptive filtering.</i></div> </p>

Maintainer: Steven Van Vaerenbergh, University of Cantabria, Spain.
Contributors:

Official web: https://github.com/steven2358/kafbox/

This toolbox is a collaborative effort: every developer wishing to contribute code or suggestions can do so. More info below.

Sample run

Figure generated by demo/demo_sample_run.m.

<p align="center"> <img src="demo/fig/kafbox_sample_run.gif" width="75%"> <div align="center"><i>Online learning of a 1D nonlinear regression by a kernel adaptive filter on a fixed budget.</i></div> </p>

Directories included in the toolbox

data/ - data sets

demo/ - demos and test files

doc/ - documentation

lib/ - algorithm libraries and utilities

Setup

  1. Run install.m to add the toolbox folders to the path.
  2. Type savepath to save the changes to the path.

Octave / Matlab pre-2008a

This toolbox uses the classdef command which is not supported in Matlab pre-2008a and not yet in Octave. The older 0.x versions of this toolbox do not use classdef and can therefore be used with all versions of Matlab and Octave. http://sourceforge.net/projects/kafbox/files/

Usage

Each kernel adaptive filtering algorithm is implemented as a Matlab class. To use one, first define its options:

options = struct('nu',1E-4,'kerneltype','gauss','kernelpar',32);

Next, create an instance of the filter. E.g., for an instance of the original KRLS algorithm run:

kaf = krls(options);

One iteration of training is performed by feeding one input-output data pair to the filter:

kaf.train(x,y);

The outputs for one or more test inputs are evaluated as follows:

Y_test = kaf.evaluate(X_test);

Example: time-series prediction

Code from demo/demo_prediction.m

% Demo: 1-step ahead prediction on Lorenz attractor time-series data
[X,Y] = kafbox_data(struct('file','lorenz.dat','embedding',6));

% make a kernel adaptive filter object of class krls with options: 
% ALD threshold 1E-4, Gaussian kernel, and kernel width 32
kaf = krls(struct('nu',1E-4,'kerneltype','gauss','kernelpar',32));

%% RUN ALGORITHM
N = size(X,1);
Y_est = zeros(N,1);
for i=1:N,
    if ~mod(i,floor(N/10)), fprintf('.'); end % progress indicator, 10 dots
    Y_est(i) = kaf.evaluate(X(i,:)); % predict the next output
    kaf.train(X(i,:),Y(i)); % train with one input-output pair
end
fprintf('\n');
SE = (Y-Y_est).^2; % test error

%% OUTPUT
fprintf('MSE after first 1000 samples: %.2fdB\n\n',10*log10(mean(SE(1001:end))));

Result:

MSE after first 1000 samples: -40.17dB

Citing KAFBOX

If you use this toolbox in your research please cite "A Comparative Study of Kernel Adaptive Filtering Algorithms":

@inproceedings{vanvaerenbergh2013comparative,
  author = {Van Vaerenbergh, Steven and Santamar{\'i}a, Ignacio},
  booktitle = {2013 IEEE Digital Signal Processing and Signal Processing Education Meeting (DSP/SPE)},
  title = {A Comparative Study of Kernel Adaptive Filtering Algorithms},
  doi = {10.1109/DSP-SPE.2013.6642587},
  pages = {181--186},
  year = {2013},
  month = aug,
  note = {Software available at \url{https://github.com/steven2358/kafbox/}}
}

Included algorithms

How to contribute code to the toolbox

Option 1: email it to steven.vanvaerenbergh@unican.es

Option 2: fork the toolbox on GitHub, push your changes, then send a pull request.

License

This source code is released under the FreeBSD License.