leila.classifiers
Class SVMClassifier

java.lang.Object
  extended by leila.classifiers.Classifier
      extended by leila.classifiers.SVMClassifier
All Implemented Interfaces:
java.io.Serializable

public class SVMClassifier
extends Classifier

This class is part of LEILA (http://mpii.de/yago-naga/leila). It is licensed under the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0) by the author Fabian M. Suchanek (http://suchanek.name).

SVMClassifier.java implements a classifier by calling Thorsten Joachim's SVMLight for each pattern. This class requires the following parameters in leila.ini:

See Also:
Serialized Form

Field Summary
static int BASISWIDTH
          Width of a basis in a feature vector
static int CONNECTORWIDTH
          Bitwidth of connector in a feature vector
 
Fields inherited from class leila.classifiers.Classifier
bridgeMap, isContracted, numFeatureObjects
 
Constructor Summary
SVMClassifier()
          Creates an SVMClassifier
 
Method Summary
 void add(LinkagePattern o)
          Adds a new LinkagePattern
 double classify(LinkagePattern v2)
          Classifies a LinkagePattern by the SVM
static void execute(java.lang.String cmd)
          Executes a command
 void printTo(java.io.Writer o)
          Prints this classifier
 SparseVector toSparseVector(LinkagePattern o)
          Creates a SparseVector from a LinkagePattern (after contraction)
 void train()
          To be called after all Patterns have been added
 
Methods inherited from class leila.classifiers.Classifier
print, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONNECTORWIDTH

public static final int CONNECTORWIDTH
Bitwidth of connector in a feature vector


BASISWIDTH

public static final int BASISWIDTH
Width of a basis in a feature vector

Constructor Detail

SVMClassifier

public SVMClassifier()
              throws java.lang.Exception
Creates an SVMClassifier

Throws:
java.lang.Exception
Method Detail

toSparseVector

public SparseVector toSparseVector(LinkagePattern o)
Creates a SparseVector from a LinkagePattern (after contraction)


classify

public double classify(LinkagePattern v2)
                throws java.lang.Exception
Classifies a LinkagePattern by the SVM

Specified by:
classify in class Classifier
Throws:
java.lang.Exception

execute

public static void execute(java.lang.String cmd)
                    throws java.lang.Exception
Executes a command

Throws:
java.lang.Exception

train

public void train()
           throws java.lang.Exception
To be called after all Patterns have been added

Specified by:
train in class Classifier
Throws:
java.lang.Exception

add

public void add(LinkagePattern o)
         throws java.lang.Exception
Adds a new LinkagePattern

Specified by:
add in class Classifier
Throws:
java.lang.Exception

printTo

public void printTo(java.io.Writer o)
             throws java.lang.Exception
Description copied from class: Classifier
Prints this classifier

Specified by:
printTo in class Classifier
Throws:
java.lang.Exception