March 10, 2017

Where can I find examples ?

Despite the list of (not exhaustive) tutorials reported in this site, the kelp-full project contains many examples of usage of KeLP.

This packages contains a set of fully functioning examples showing how to implement a learning system with KeLP. Batch learning algorithm as well as online learning algorithms usage is shown here. Different examples cover the usage of standard kernel, tree kernels and sequence kernel, with caching mechanisms, e.g:


  • QuestionClassification (it.uniroma2.sag.kelp.examples.demo.qc): this class implements the Question Classification demo. It includes both kernel operating on vectors and kernel operating on trees (stk, ptk, sptk, csptk).
  • QuestionClassificationLearningFromJson (it.uniroma2.examples.demo.qc): the same demo as QuestionClassification with the difference that the learning algorithm specification is read from a Json file.
  • RCV1BinaryTextCategorizationLibLinear, RCV1BinaryTextCategorizationPA,RCV1BinaryTextCategorizationPegasos, RCV1BinaryTextCategorizationDCD and RCV1BinaryTextCategorizationSCW(it.uniroma2.sag.kelp.examples.demo.rcv1) are examples of binary classifiers on the RCV1 dataset that can be found on the LibLinear website. These classes perform a N-Fold Cross Validation and show KeLP facilities to divide a dataset in N-Fold.
  • TweetSentimentAnalysisSemeval2013 (it.uniroma2.sag.kelp.examples.demo.tweetsent2013): a demo with multiple kernels and multiple classes on a dataset for the Twitter Sentiment Analysis task of Semeval2013.
  • NystromExampleMain (it.uniroma2.sag.kelp.examples.demo.nystrom): an example that shows the usage of the NystromMethod to project examples into linear representation, i.e. vectors. It is used within Question Classification.
  • OneVsAllSVMExample (it.uniroma2.sag.kelp.examples.main): an example that shows the usage of the OneVsAll strategy with SVM over the IRIS dataset for a multiclassification schema.
  • SequenceKernelExample (it.uniroma2.sag.kelp.examples.main): an example that shows the usage of a Sequence Kernel.
  • MultipleRepresentationExample (it.uniroma2.sag.kelp.examples.main): a basic example showing the usage of multiple representations with multiple kernel functions with a PassiveAggressive algorithm.
  • KernelCacheExample (it.uniroma2.sag.kelp.examples.main): an example that shows the usage of the KernelCache class to store the already computed kernel values between instances.
  • MutagClassification (it.uniroma2.sag.kelp.examples.demo.mutag); an example that shows the application of graph kernels to the mutag dataset


  • EpsilonSVRegressionExample (it.uniroma2.sag.kelp.examples.demo.regression): This class contains an example of the usage of the Regression Example. The regressor implements the e-SVR learning algorithm discussed in [CC Chang & CJ Lin, 2011]. In this example a dataset is loaded from a file and then split in train and test.


  • KernelBasedClusteringExample (it.uniroma2.sag.kelp.examples.demo.clustering): this class contains an example of the usage of the Kernel-based clustering.
  • LinearKMeansClusteringExample (it.uniroma2.sag.kelp.examples.demo.clustering): this class contains an example of the usage of the Linear K-means clustering.

General Purpose:

  • ClassificationDemo (it.uniroma2.sag.kelp.examples.main): it is a meta-learner that takes in input a Json description and a dataset.
  • Learn (it.uniroma2.sag.kelp.main): the main file for learning a model. It takes in input a training dataset, a learning algorithm description in JSON and the path where the model will be saved.
  • Classify (it.uniroma2.sag.kelp.main): the main file for classification. It takes in input the dataset to be classified, a previously learned model and the path where to store the final classifications.