This package contains an implementation of the Polynomial String Kernel and a linear time String Kernel algorithm as described in our paper, High Resolution Ancestry Deconvolution for Next Generation Genomic Data.
It offers
-
Linear time computation of two effective string kernels.
-
Compatibility with Scikit-Learn's Support Vector Machines (easy plug-in).
-
Multithreading.
To install the package, execute from the command line
pip install string-kernels
And then you're all set!
Assuming you have Scikit-Learn already installed, you can use Lodhi's string kernel via
from sklearn import svm
from stringkernels.kernels import string_kernel
model = svm.SVC(kernel=string_kernel())
and the polynomial string kernel,
from sklearn import svm
from stringkernels.kernels import polynomial_string_kernel
model = svm.SVC(kernel=polynomial_string_kernel())
For morer information read the docs or take a look at the notebook example.ipynb for further demonstration of usage.
If you end up using this in your research we kindly ask you to cite us! :)