RLS2 MATLAB Toolbox is a set of scripts that implements RLS2 (regularized least squares with two layers) and RLS2LIN (linear regularized least squares with two layers).

RLS2 is an instance of multiple kernel learning algorithm that can be used to simultaneously learn a regularized predictor and the kernel function. It is also an instance of kernel machine with two layers that extends the classic regularized least squares algorithm.

RLS2LIN implements a version of RLS2 specialized to linear kernels on each feature. The algorithm simultaneously performs regularization and linear feature selection, is memory efficient and very well suited for datasets with a large number of features.

The package contains a Graphic User Interface (GUI) to load data, perform training and validation of RLS2 models, and plot results. The features of the toolbox include:

  • Data pre-processing.
  • Efficient regularization path computation.
  • Cross-validation.
  • Random splits.
  • Hold-out set validation.
  • Multi-class classification (one versus all)
  • Multi-output regression
  • Approximate degrees of freedom computation.
  • Plot results and export figures to PDF format.
Currently, RLS2 only supports memory-stored kernels. If your dataset is large, consider using RLS2LIN first.


Francesco Dinuzzo. Kernel machines with two layers and multiple kernel learning. Preprint arXiv:1001.2709.


RLS2 Toolbox Screenshot 1

RLS2 Toolbox Screenshot 2

File list

  • rls2.m (Regularized least squares with two layers - training)
  • rls2eval.m (Regularized least squares with two layers - test)
  • rls2lin.m (Regularized least squares linear with two layers - training)
  • rls2lineval.m (Regularized least squares linear with two layers - test)
  • gpl.txt (GNU license)
  • readme.txt
  • rls2tools.m (Graphic User Interface for RLS2 and RLS2LIN - .m file)
  • rls2tools.fig (Graphic User Interface for RLS2 and RLS2LIN - .fig file)
  • kernels/default.m (Example of function computing a set of basis kernel matrices.)
  • kernels/rbfall.m (RBF Kernels on all the features)
  • kernels/polyall.m (Polynomial kernels on all the features)
  • kernels/rbfsingle.m (RBF Kernels on each feature separately)
  • kernels/polysingle.m (Polynomial kernels on each feature separately)
  • data/heart.mat (Example classification dataset)
  • data/housing.mat (Example regression dataset)
  • data/iris.mat (Example multi-classification dataset)
  • data/prostate.mat (Example regression dataset with pre-defined validation set)
  • data/binarystrings.mat (Regression dataset with inputs in logical format)
  • doc/tutorial.pdf (Tutorial)


To install the toolbox, simply unpack into some folder and add that folder to the MATLAB path, by selecting "Set Path..." from the File menu. To enable the Generate PDF plots feature of the GUI, you need to download the script save2pdf.m and save it into the Matlab path.


Copyright © 2010 Francesco Dinuzzo

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see


Please read the license before downloading the toolbox.