jnisvmlight
Class SVMLightInterface


java.lang.Object

  extended by jnisvmlight.SVMLightInterface


public class SVMLightInterface
extends java.lang.Object

The main interface class that transfers the training data to the SVM-light library by a native call. Optionally takes as input an individually modified set of training parameters or an array of string paramaters that exactly simulate the command line input parameters used by the SVM-light binaries. This class can also be used for native classification calls.


Field Summary
protected  TrainingParameters m_tp
           
static boolean SORT_INPUT_VECTORS
          Apply an in-place quicksort prior to each native training call to SVM-light.
 
Constructor Summary
SVMLightInterface()
           
 
Method Summary
 double classifyNative(FeatureVector doc)
          Performs a classifcation step as a native call to SVM-light.
static LabeledFeatureVector[] getLabeledFeatureVectorsFromURL(java.net.URL file, int numOfLinesToSkip)
          Reads a set of labeled training vectors from a URL.
 TrainingParameters getTrainingParameters()
           
 SVMLightModel trainModel(LabeledFeatureVector[] trainingData)
           
 SVMLightModel trainModel(LabeledFeatureVector[] trainingData, java.lang.String[] argv)
           
 SVMLightModel trainModel(LabeledFeatureVector[] trainingData, TrainingParameters tp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SORT_INPUT_VECTORS


public static boolean SORT_INPUT_VECTORS
Apply an in-place quicksort prior to each native training call to SVM-light. SVM-light requires each input feature vector to be sorted in ascending order of dimensions. Disable this option if you are sure to provide sorted vectors already.


m_tp


protected TrainingParameters m_tp
Constructor Detail

SVMLightInterface


public SVMLightInterface()
Method Detail

getLabeledFeatureVectorsFromURL


public static LabeledFeatureVector[] getLabeledFeatureVectorsFromURL(java.net.URL file,

                                                                     int numOfLinesToSkip)

                                                              throws java.text.ParseException
Reads a set of labeled training vectors from a URL. The format is compatible to the SVM-light training files.

Throws:
java.text.ParseException

classifyNative


public double classifyNative(FeatureVector doc)
Performs a classifcation step as a native call to SVM-light. If this method is used exlusively, no additional SVMLightModel object has to be kept in the Java runtime process.


getTrainingParameters


public TrainingParameters getTrainingParameters()

trainModel


public SVMLightModel trainModel(LabeledFeatureVector[] trainingData)

trainModel


public SVMLightModel trainModel(LabeledFeatureVector[] trainingData,

                                java.lang.String[] argv)

trainModel


public SVMLightModel trainModel(LabeledFeatureVector[] trainingData,

                                TrainingParameters tp)