netkit.classifiers.relational
Class WeightedVoteRelationalNeighbor
java.lang.Object
netkit.classifiers.ClassifierImp
netkit.classifiers.relational.NetworkClassifierImp
netkit.classifiers.relational.WeightedVoteRelationalNeighbor
- All Implemented Interfaces:
- Classifier, NetworkClassifier, Configurable
public final class WeightedVoteRelationalNeighbor
- extends NetworkClassifierImp
weighted-vote Relational Neighbor Classifier (wvRN).
Reference:
- 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.
NOTE: This builds a model only on the neighborhood class labels.
Parameters:
.laplace=None
.laplaceone=false
.lfactor=1.0
.rfactor=0.0
Equivalent hard-coded parameters:
.aggregation=ClassOnly
.aggregators=count
- Author:
- Sofus A. Macskassy
Fields inherited from class netkit.classifiers.ClassifierImp |
attribute, classPrior, clsIdx, graph, keyIndex, logger, nodeType, right, tmpVector, useIntrinsic, vectorClsIdx |
Method Summary |
void |
configure(Configuration conf)
Configures the classifier with respect to laplace correction: whether to have it (and what kind) and
whether tu use it only on the first iteration of collective inferencing. |
boolean |
doEstimate(Node node,
double[] estimation)
This is the final estimation method that will be called and the only estimation
method that sub-classes should implement. |
Configuration |
getDefaultConfiguration()
Creates and returns a default configuration, which only includes the laplaceonce, laplace and lfactor
properties (the only ones used in this classifier as nothing else is not configurable). |
java.lang.String |
getDescription()
|
java.lang.String |
getName()
|
java.lang.String |
getShortName()
|
void |
induceModel(Graph graph,
DataSplit split)
wvRN has no model, so this only initializes what needs to be done for laplace correction
(in addition to whatever the superclass does). |
void |
initializeRun(Estimate currPrior,
Node[] unknowns)
This initializes wvRN for the next collective inference iteration by setting up the
laplace correction, if needed, for the current iteration. |
java.lang.String |
toString()
|
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 |
WeightedVoteRelationalNeighbor
public WeightedVoteRelationalNeighbor()
getShortName
public java.lang.String getShortName()
- Returns:
- return "wvRN"
getName
public java.lang.String getName()
- Returns:
- return "Weighted Vote Relational Neighbor NetworkClassifier (wvRN)"
getDescription
public java.lang.String getDescription()
- Returns:
- return "See reference: [Macskassy, Provost] 'Classification in Networked Data'"
getDefaultConfiguration
public Configuration getDefaultConfiguration()
- Creates and returns a default configuration, which only includes the laplaceonce, laplace and lfactor
properties (the only ones used in this classifier as nothing else is not configurable). By default,
there is no laplace correction.
- Specified by:
getDefaultConfiguration
in interface Configurable
- Overrides:
getDefaultConfiguration
in class NetworkClassifierImp
- Returns:
- configation object
configure
public void configure(Configuration conf)
- Configures the classifier with respect to laplace correction: whether to have it (and what kind) and
whether tu use it only on the first iteration of collective inferencing.
- Specified by:
configure
in interface Configurable
- Overrides:
configure
in class NetworkClassifierImp
- Parameters:
conf
- Configuration object to use to configure the classifier- See Also:
NetworkClassifierImp.aggregation
initializeRun
public void initializeRun(Estimate currPrior,
Node[] unknowns)
- This initializes wvRN for the next collective inference iteration by setting up the
laplace correction, if needed, for the current iteration. If the laplace correction is
external, then it caches the class priors on the first iteration as they are the external
priors. If we should only use laplace correction the first time, then laplace correction
is set to None after the first iteration
- Specified by:
initializeRun
in interface NetworkClassifier
- Overrides:
initializeRun
in class NetworkClassifierImp
- Parameters:
currPrior
- The current priors for all nodes in the graphunknowns
- The list of nodes whose labels are unknown
induceModel
public void induceModel(Graph graph,
DataSplit split)
- wvRN has no model, so this only initializes what needs to be done for laplace correction
(in addition to whatever the superclass does).
- Specified by:
induceModel
in interface Classifier
- Overrides:
induceModel
in class NetworkClassifierImp
- Parameters:
graph
- The graph to induce a model oversplit
- The data split identifying which nodes have known and unknown labels- See Also:
NetworkClassifierImp.induceModel(netkit.graph.Graph, netkit.classifiers.DataSplit)
doEstimate
public boolean doEstimate(Node node,
double[] estimation)
- Description copied from class:
NetworkClassifierImp
- This is the final estimation method that will be called and the only estimation
method that sub-classes should implement.
- Specified by:
doEstimate
in class NetworkClassifierImp
- Parameters:
node
- estimation
-
- Returns:
- true
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object