netkit.classifiers.nonrelational
Class LocalWeka
java.lang.Object
netkit.classifiers.ClassifierImp
netkit.classifiers.nonrelational.LocalWeka
- All Implemented Interfaces:
- Classifier, Configurable
public final class LocalWeka
- extends ClassifierImp
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):
- classifier: the weka classifier (name should be defined in the
weka.properties
file.
- options: optional string that specifies the commandline options to pass to the weka classifier.
- Author:
- Sofus A. Macskassy (sofmac@gmail.com)
- See Also:
netkit.classifiers.NetworkLearning.LC_PREFIX
Fields inherited from class netkit.classifiers.ClassifierImp |
attribute, classPrior, clsIdx, graph, keyIndex, logger, nodeType, right, tmpVector, useIntrinsic, vectorClsIdx |
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 |
estimate(Node node,
double[] result)
Predict class labels for the given node. |
java.lang.String |
getDescription()
|
java.lang.String |
getName()
|
java.lang.String |
getShortName()
|
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.ClassifierImp |
addListener, classify, classify, clearListeners, estimate, estimate, getAttributeNames, getDefaultConfiguration, getLogger, getNofifyListeners, makeVector, notifyListeners, notifyListeners, removeListener, reset, setNofityListeners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LocalWeka
public LocalWeka()
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 ClassifierImp
- Parameters:
config
- The configuration object used to configure this classifier
getShortName
public java.lang.String getShortName()
- Returns:
- 'LocalWeka(WEKA-LEARNER-NAME)'
getName
public java.lang.String getName()
- Returns:
- 'LocalWeka(WEKA-LEARNER-NAME)[WEKA-FULLY-SPECIFIED-CLASSNAME]'
getDescription
public java.lang.String getDescription()
- Returns:
- 'A Wrapper for a weka classifier using only intrinsic attributes'
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 ClassifierImp
- Parameters:
graph
- Graph whose nodes are to be estimatedsplit
- The split between training and test. Used to get the nodetype and class attribute.
estimate
public boolean estimate(Node node,
double[] result)
- Predict class labels for the given node.
- Parameters:
node
- The node to estimate class probabilities forresult
- 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