netkit.classifiers.relational
Class NetworkOnlyBayes

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

public final class NetworkOnlyBayes
extends NetworkClassifierImp

Network-only Bayes Classifier induces a naive Bayes model based on labels of neighbors of a node and uses a Markov random field formulation when one or more neighbors have estimated labels. References:

This replicates the network-only bayes as described in the univariate reference paper. This classifier applies Markov Random Field techniques for dealing with uncertainty in neighborhood (and local) attribute values, and can therefore be used with Relaxation Labeling. This is not the case for the Weka bayes classifier, where you would need the (pseudo-)certainty that is given by Iterative classification and Gibbs sampling. NOTE: This currently takes no parameters and builds a model only on the neighborhood class labels. This is equivalent to these parameters:
.aggregation=ClassOnly
.aggregators=??? (there is no current aggregation technique for uncertainy)
.useintrinsic=false

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

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
 
Fields inherited from class netkit.classifiers.ClassifierImp
attribute, classPrior, clsIdx, graph, keyIndex, logger, nodeType, right, tmpVector, useIntrinsic, vectorClsIdx
 
Constructor Summary
NetworkOnlyBayes()
           
 
Method Summary
 void configure(Configuration config)
          Configures this classifier.
 boolean doEstimate(Node node, double[] estimation)
          compute class estimates.
 Configuration getDefaultConfiguration()
          Create a default configuration for this classifier.
 java.lang.String getDescription()
           
 java.lang.String getName()
           
 java.lang.String getShortName()
           
 void induceModel(Graph graph, DataSplit split)
          Induce the model by computing the counts for Prob(classIdx | neighborClassIdx)
 void reset()
          Resets internal variables.
 java.lang.String toString()
           
 
Methods inherited from class netkit.classifiers.relational.NetworkClassifierImp
classify, estimate, estimate, estimate, estimate, generateAggregators, getAttributeNames, includeClassAttribute, initializeRun, makeVector
 
Methods inherited from class netkit.classifiers.ClassifierImp
addListener, classify, classify, clearListeners, estimate, estimate, getLogger, getNofifyListeners, notifyListeners, notifyListeners, removeListener, 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, setNofityListeners
 

Constructor Detail

NetworkOnlyBayes

public NetworkOnlyBayes()
Method Detail

getShortName

public java.lang.String getShortName()
Returns:
"NetworkOnlyBayes"

getName

public java.lang.String getName()
Returns:
"Network-Only Bayes NetworkClassifier with MRF internals (NetworkOnlyBayes)"

getDescription

public java.lang.String getDescription()
Returns:
"See reference: [Macskassy, Provost] 'Simple Models' - nBC"

getDefaultConfiguration

public Configuration getDefaultConfiguration()
Create a default configuration for this classifier. It sets the 'sampleneighbors' property to -1. It otherwise uses the configuration from the super class.

Specified by:
getDefaultConfiguration in interface Configurable
Overrides:
getDefaultConfiguration in class NetworkClassifierImp
Returns:
a default configuration with 'sampleneighbors' set to -1.
See Also:
NetworkClassifierImp.getDefaultConfiguration()

configure

public void configure(Configuration config)
Configures this classifier. does the super class configuration and then uses 'sampleneighbors' sets the maximum number of neighbor edges to use. Random sampling will be used if a node has more than this number of edges.

Specified by:
configure in interface Configurable
Overrides:
configure in class NetworkClassifierImp
Parameters:
config - The configuration object to use.
See Also:
NetworkClassifierImp.configure(netkit.util.Configuration)

reset

public void reset()
Resets internal variables.

Specified by:
reset in interface Classifier
Overrides:
reset in class ClassifierImp
See Also:
ClassifierImp.reset()

induceModel

public void induceModel(Graph graph,
                        DataSplit split)
Induce the model by computing the counts for Prob(classIdx | neighborClassIdx)

Specified by:
induceModel in interface Classifier
Overrides:
induceModel in class NetworkClassifierImp
Parameters:
graph - The graph to induce the model over
split - The datasplit telling the classifier which nodes have known labels and which do not
See Also:
NetworkClassifierImp.induceModel(netkit.graph.Graph, netkit.classifiers.DataSplit)

doEstimate

public boolean doEstimate(Node node,
                          double[] estimation)
compute class estimates.

Specified by:
doEstimate in class NetworkClassifierImp
Parameters:
node - The node to estimate class probabilities for
estimation - 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