netkit.classifiers.relational
Class NetworkOnlyBayes
java.lang.Object
netkit.classifiers.ClassifierImp
netkit.classifiers.relational.NetworkClassifierImp
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:
- Soumen Chakrabarti, Byron Dom and Piotr Indyk (1998)
Enhanced Hypertext Categorization Using Hyperlinks,
SIGMOD, 1998
- Sofus A. Macskassy, Foster Provost (2007).
Classification in Networked Data: A toolkit and a univariate case study.
Journal of Machine Learning, 8(May):935-983, 2007.
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)
Fields inherited from class netkit.classifiers.ClassifierImp |
attribute, classPrior, clsIdx, graph, keyIndex, logger, nodeType, right, tmpVector, useIntrinsic, vectorClsIdx |
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 |
NetworkOnlyBayes
public NetworkOnlyBayes()
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 oversplit
- 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 forestimation
- 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