netkit.classifiers.io
Class ReadClassificationGeneric

java.lang.Object
  extended by netkit.classifiers.io.ReadClassificationGeneric
All Implemented Interfaces:
ReadClassification

public final class ReadClassificationGeneric
extends java.lang.Object
implements ReadClassification

Reads in true labels of entities in a graph from a file where the format of each line is:

nodeID,class
Lines starting with '#' are ignored

Author:
Sofus A. Macskassy (sofmac@gmail.com)

Constructor Summary
ReadClassificationGeneric()
           
 
Method Summary
 void readClassification(Graph graph, Classification labels, java.io.File input)
          Reads in a set of classifications from the given file, assuming that each line is of the form 'nodeID,class'.
 Classification readClassification(Graph graph, java.lang.String nodeType, AttributeCategorical attribute, java.io.File input)
          Creates a new Classification object based on the graph, nodeType and attribute and then calls the generic readClassification method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadClassificationGeneric

public ReadClassificationGeneric()
Method Detail

readClassification

public Classification readClassification(Graph graph,
                                         java.lang.String nodeType,
                                         AttributeCategorical attribute,
                                         java.io.File input)
Creates a new Classification object based on the graph, nodeType and attribute and then calls the generic readClassification method.

Specified by:
readClassification in interface ReadClassification
Parameters:
graph -
nodeType -
attribute -
input -
Returns:
a filled-in Classification object
See Also:
readClassification(netkit.graph.Graph, netkit.classifiers.Classification, java.io.File)

readClassification

public void readClassification(Graph graph,
                               Classification labels,
                               java.io.File input)
Reads in a set of classifications from the given file, assuming that each line is of the form 'nodeID,class'. (Lines starting with '#' are ignored)

ASSUMPTION: The underlying categorical attribute has already been initialized with the valid names for the attributes. Otherwise exceptions will be thrown!

Specified by:
readClassification in interface ReadClassification
Parameters:
graph -
labels - The Classification object to fill in
input -