leila.classifiers
Class KNNClassifier

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

public class KNNClassifier
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).

Classifier.java represents a simple KNN-Classifier for a set of StoredFeatureObjects.

See Also:
Serialized Form

Field Summary
static double blackHole
          All feature objects more similar than this value fall into the same equivalence class
 
Fields inherited from class leila.classifiers.Classifier
bridgeMap, isContracted, numFeatureObjects
 
Constructor Summary
KNNClassifier()
           
 
Method Summary
 void add(LinkagePattern o)
          Adds a new LinkagePattern
 double classify(LinkagePattern o)
          Returns a similarity measure
 void printTo(java.io.Writer o)
          Prints this classifier
 java.lang.String toString()
          Returns the list of featureObjects, might be long, so use printTo instead!
 void train()
          Contracts the data
 
Methods inherited from class leila.classifiers.Classifier
print
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

blackHole

public static double blackHole
All feature objects more similar than this value fall into the same equivalence class

Constructor Detail

KNNClassifier

public KNNClassifier()
Method Detail

add

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

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

toString

public java.lang.String toString()
Returns the list of featureObjects, might be long, so use printTo instead!

Overrides:
toString in class Classifier

classify

public double classify(LinkagePattern o)
                throws java.lang.Exception
Returns a similarity measure

Specified by:
classify 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

train

public void train()
           throws java.lang.Exception
Contracts the data

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