This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

MKLpy is a framework for Multiple Kernel Learning and kernel machines scikit-compliant.

This package contains:

  • some MKL algorithms and kernel machines, such as EasyMKL and KOMD;
  • a meta-MKL-classifier used in multiclass problems according to one-vs-one pattern;
  • a meta-MKL-classifier for MKL algorithms based on heuristics;
  • tools to generate and handle list of kernels in an efficient way;
  • tools to operate over kernels, such as normalization, centering, summation, mean…;
  • metrics, such as kernel_alignment, radius…;
  • kernel functions, such as HPK and boolean kernels (disjunctive, conjunctive, DNF, CNF).

For more informations about classification, kernels and predictors visit Link scikit-learn

requirements

To work properly, MKLpy requires:

  • numpy
  • scikit-learn
  • cvxopt

examples

Generation phase

It is possible to exploit some generators to make a list of kernels. In the following example we rescale and normalize data, then we create a list of 20 Homogeneous Polynomial Kernel with degrees 1..20

from MKLpy.lists import HPK_generator
from MKLpy.regularization import rescale_01, normalization
X = rescale_01(X)
X = normalization(X)
KL = HPK_generator(X).make_a_list(20).to_array()

It is possible to create any custom lists

KL = np.array([np.dot(X,X.T)**d for d in range(1,21)])

Training phase

A kernel list is used as input of MKL algorithms. The interface of a generic MKL algorithm is the same of all predictors in scikit-learn, with the difference that the .fit method can has a list of kernels as input instead a single one or a samples matrix.

from MKLpy.algorithms import EasyMKL
clf = EasyMKL(lam=0.1, kernel='precomputed')
clf = clf.fit(KL,Y)

it is also possible to learn a kernel combination with an MKL algorithm and fit the model using another kernel machine, such as an SVC

from sklearn.svm import SVC
ker_matrix = EasyMKL(lam=0.1, kernel='precomputed').arrange_kernel(KL,Y)
ker_matrix = np.array(ker_matrix)
clf = SVC(C=2, kernel='precomputed').fit(ker_matrix,Y)

Evaluation phase

from MKLpy.model_selection import cv3
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import StratifiedShuffleSplit
train,test = StratifiedShuffleSplit(n_split=1).split(X,Y).next()
tr,te = cv3(train,test,n_kernels)
KL_tr = KL[tr]
KL_te = KL[te]
Y_tr  = Y[train]
Y_te  = Y[test]
clf = EasyMKL(kernel='precomputed').fit(KL_tr,Y_tr)
y_score = EasyMKL.decision_function(KL_te)
AUC = roc_auc_score(Y_te,y_score)

Some useful stuff

some metrics…

from MKLpy.metrics import radius,margin
K = np.dot(X,X)**2
rMEB = radius(K)   //rMEB is the radius of the closest hypersphere that contains the data
m = margin(K,Y)     //m is the margin between the classes, it works only in binary context
Release History

Release History

0.1.3.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3.2rc0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3.2b0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1.25b

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1.24b

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1.23b

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1.22b

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
MKLpy-0.1.3.2.tar.gz (30.6 kB) Copy SHA256 Checksum SHA256 Source May 11, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting