Skip to content

Multiple Kernel Least Squares Suport Vector Machine provide classification model.

License

Notifications You must be signed in to change notification settings

FormMe/MultipleKernel-LeastSquares-SupportVectorMachine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MultipleKernel-LeastSquares-SuportVectorMachine

The research thesis report in Russian presented in report.pdf

Firstly import package

from mk_ls_svm_lib as mk

Create instance of classificator with list of kernels

kernel_set = [mk.kernel.RBF(10), mk.kernel.Poly(1,2)]
clf = mk.mk_ls_svm.MKLSSVM(kernel_set)

Fit classificator

import numpy as np
X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])
y = np.array([1, 1, 2, 2]) 
clf = clf.fit(X,y)

Predict

predicted_y = clf.predict(X)

You can save your classificator into file

clf.to_pkl('my_clf.pkl')

And load it

clf = mk.mk_ls_svm.load_clf_from_pkl('my_clf.pkl') 

Also you can use built-in k-fold crossvalidation

score = mk.crossvalidation.cross_val_score(clf, X, y)