Skip to content


MKLpy is a framework for Multiple Kernel Learning (MKL) inspired by the scikit-learn project. The library encapsulates everything you need to run MKL algorithms, from the kernels computation to the final evaluation.

MKLpy contains:

  • the implementation of MKL algorithms (EasyMKL, GRAM);
  • kernel functions (polynomial, boolean kernels, and string kernels);
  • various metrics and tools (kernel_alignment, radius, margin, spectral ratio...)

The main MKL algorithms implemented in this library are

Name Short description Status Source
AverageMKL Computes the simple average of base kernels Available -
EasyMKL Fast and memory efficient margin-based combination Available [1]
GRAM Radius/margin ratio optimization Available [2]
R-MKL Radius/margin ratio optimization Available [3]
MEMO Margin maximization and complexity minimization Available [4]
PWMK Heuristic based on individual kernels performance Avaible [5]
FHeuristic Heuristic based on kernels alignment Available [6]
CKA Centered kernel alignment optimization in closed form Available [7]
SimpleMKL Alternate margin maximization Work in progress [8]


The Tutorials section contains useful snippets of code to start with MKLpy.


MKLpy is available on PyPI:

pip install MKLpy

MKLpy requires pytorch, scikit-learn, and cvxopt installed.

Work in progress

MKLpy is under development! We are working to integrate several new features, including:

  • further MKL algorithms, such as MEMO, and SimpleMKL;
  • additional kernels for structured data (graphs, trees);
  • efficient optimization

Known issues

  • When dealing with normalized kernels, you need to (i) compute the complete kernel matrix (training + test examples) and to (ii) split the matrix into training and test matrices. Currently, you cannot directly compute the normalized kernel for training and test. This is not efficient and it will be fixed in the next releases.

  • Some boolean kernels (DNF and CNF kernels) are currently disabled.

  • The documentation for developers, containing directives and tools to develop novel algorithms and functionalities, is currently not available.

  • We're fixing some issues related to SimpleMKL. The algorithm will be available in the next weeks.

Citing MKLpy

If you use MKLpy for a scientific purpose, please cite the following preprint.

  title={MKLpy: a python-based framework for Multiple Kernel Learning},
  author={Lauriola, Ivano and Aiolli, Fabio},
  journal={arXiv preprint arXiv:2007.09982},