netkit.classifiers.relational
Class NetworkWeka

java.lang.Object
  extended by netkit.classifiers.ClassifierImp
      extended by netkit.classifiers.relational.NetworkClassifierImp
          extended by netkit.classifiers.relational.NetworkWeka
All Implemented Interfaces:
Classifier, NetworkClassifier, Configurable

public final class NetworkWeka
extends NetworkClassifierImp

Weka wrapper that uses a specified weka classifier to do its predictions. This includes converting all attributes into the weka format. The classifier uses a Factory to read the weka.properties file to look up a named weka classifier.

The classifier itself uses two properties (specified in the lclassifier.properties file):

Author:
Sofus A. Macskassy (sofmac@gmail.com)
See Also:
netkit.classifiers.NetworkLearning.LC_PREFIX

Nested Class Summary
 
Nested classes/interfaces inherited from class netkit.classifiers.relational.NetworkClassifierImp
NetworkClassifierImp.Aggregation
 
Field Summary
 
Fields inherited from class netkit.classifiers.relational.NetworkClassifierImp
aggFactory, aggregation, aggregators, aggTypes, dynamicAggregators, prior
 
Fields inherited from class netkit.classifiers.ClassifierImp
attribute, classPrior, clsIdx, graph, keyIndex, logger, nodeType, right, tmpVector, useIntrinsic, vectorClsIdx
 
Constructor Summary
NetworkWeka()
           
 
Method Summary
 void configure(Configuration config)
          Configure this classifier by getting the Weka classifier object using the classifier and options properties in addition to anything used by the superclass.
 boolean doEstimate(Node node, double[] result)
          Predict class labels for the given node.
 java.lang.String getDescription()
           
 java.lang.String getName()
           
 java.lang.String getShortName()
           
protected  boolean includeClassAttribute()
          This classifier needs to include the class attribute at all times because the Weka classifier needs it.
 void induceModel(Graph graph, DataSplit split)
          Induce the weka classifier by creating a training Instances object according to the schema of the nodes to be classified.
 java.lang.String toString()
           
 
Methods inherited from class netkit.classifiers.relational.NetworkClassifierImp
classify, estimate, estimate, estimate, estimate, generateAggregators, getAttributeNames, getDefaultConfiguration, initializeRun, makeVector
 
Methods inherited from class netkit.classifiers.ClassifierImp
addListener, classify, classify, clearListeners, estimate, estimate, getLogger, getNofifyListeners, notifyListeners, notifyListeners, removeListener, reset, setNofityListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface netkit.classifiers.Classifier
addListener, classify, classify, clearListeners, estimate, estimate, getLogger, getNofifyListeners, notifyListeners, notifyListeners, removeListener, reset, setNofityListeners
 

Constructor Detail

NetworkWeka

public NetworkWeka()
Method Detail

configure

public void configure(Configuration config)
Configure this classifier by getting the Weka classifier object using the classifier and options properties in addition to anything used by the superclass. The classifier property defines the weka classifier (this name should resolve to a real weka class name in the weka.properties file). The options property defines the options string to pass to the weka classifier.

Specified by:
configure in interface Configurable
Overrides:
configure in class NetworkClassifierImp
Parameters:
config - The configuration object used to configure this classifier
See Also:
NetworkClassifierImp.aggregation

includeClassAttribute

protected boolean includeClassAttribute()
This classifier needs to include the class attribute at all times because the Weka classifier needs it.

Overrides:
includeClassAttribute in class NetworkClassifierImp
Returns:
true

getShortName

public java.lang.String getShortName()
Returns:
"NetworkWeka(LEARNER)"

getName

public java.lang.String getName()
Returns:
"NetworkWeka(LEARNER)[LEARNER-class]"

getDescription

public java.lang.String getDescription()
Returns:
"A Wrapper for a weka network-classifier"

induceModel

public void induceModel(Graph graph,
                        DataSplit split)
Induce the weka classifier by creating a training Instances object according to the schema of the nodes to be classified.

Specified by:
induceModel in interface Classifier
Overrides:
induceModel in class NetworkClassifierImp
Parameters:
graph - Graph whose nodes are to be estimated
split - The split between training and test. Used to get the nodetype and class attribute.
See Also:
NetworkClassifierImp.generateAggregators(), NetworkClassifierImp.aggregators, ClassifierImp.induceModel(netkit.graph.Graph, netkit.classifiers.DataSplit), ClassifierImp.tmpVector, ClassifierImp.vectorClsIdx

doEstimate

public boolean doEstimate(Node node,
                          double[] result)
Predict class labels for the given node.

Specified by:
doEstimate in class NetworkClassifierImp
Parameters:
node - The node to estimate class probabilities for
result - the double array containing the probability estimates that the node belongs to each of the possible class labels.
Returns:
true

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object