netkit.classifiers.relational
Class ClassDistribRelNeighbor
java.lang.Object
netkit.classifiers.ClassifierImp
netkit.classifiers.relational.NetworkClassifierImp
netkit.classifiers.relational.ClassDistribRelNeighbor
- All Implemented Interfaces:
- Classifier, NetworkClassifier, Configurable
public final class ClassDistribRelNeighbor
- extends NetworkClassifierImp
The Class Distributional Relational Neighbor (ClassDistributRelNeighbor) classifier
works by creating a 'prototypical' class vector for each class of node and then
estimating a label for a new node by calculating how near that new node is to each
of these 'class reference vectors'.
Properties:
- distance: the distance function to use. default=cosine. See
distance.properties
- useintrinsic: whether to use intrinsic attributes. default=false
- aggregation: what attributes to aggregate on. default=classOnly
- aggregators: what aggregators to use. default=ratio
- 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 |
Method Summary |
void |
configure(Configuration config)
Configure this classifier object. |
boolean |
doEstimate(Node node,
double[] result)
Estimate how near this node's neighborhood is to each of the class vectors using
a user-specified distance function (cosine by default) and normalize to produce
a pseudo distribution. |
Configuration |
getDefaultConfiguration()
Get the detault configuration of using a cosine distance function, and aggregating
only on the class attribute using the ratio aggregator. |
java.lang.String |
getDescription()
|
java.lang.String |
getName()
|
java.lang.String |
getShortName()
|
void |
induceModel(Graph graph,
DataSplit split)
Induce the cdRN model by finding the 'prototypical' neighborhood for each class
of nodes. |
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 |
ClassDistribRelNeighbor
public ClassDistribRelNeighbor()
getDefaultConfiguration
public Configuration getDefaultConfiguration()
- Get the detault configuration of using a cosine distance function, and aggregating
only on the class attribute using the ratio aggregator. This is in addition to any
defaults set by the superclass.
- Specified by:
getDefaultConfiguration
in interface Configurable
- Overrides:
getDefaultConfiguration
in class NetworkClassifierImp
- Returns:
- a Configuration object
- See Also:
NetworkClassifierImp.getDefaultConfiguration()
configure
public void configure(Configuration config)
- Configure this classifier object. All but the distance function is taken care of by
the super class. The distance function is gotten by using a Factory class on the
distance.properties
file, so the name of the distance function should
appear in that file.
- Specified by:
configure
in interface Configurable
- Overrides:
configure
in class NetworkClassifierImp
- Parameters:
config
- The Configuration object used to configure this classifier.- See Also:
NetworkClassifierImp.configure(netkit.util.Configuration)
getShortName
public java.lang.String getShortName()
- Returns:
- 'classDistribRN'
getName
public java.lang.String getName()
- Returns:
- 'Class-Distributional Relational Neighbor NetworkClassifier (classDistribRN)'
getDescription
public java.lang.String getDescription()
- Returns:
- 'No description yet'
induceModel
public void induceModel(Graph graph,
DataSplit split)
- Induce the cdRN model by finding the 'prototypical' neighborhood for each class
of nodes. By default, this neighborhood consists only of the neighboring class
labels, but this can easily include any intrinsic or aggregate attributes.
- Specified by:
induceModel
in interface Classifier
- Overrides:
induceModel
in class NetworkClassifierImp
- Parameters:
graph
- Graph whose nodes are to be estimatedsplit
- The split between training and test. Used to get the nodetype and class attribute.- See Also:
NetworkClassifierImp.induceModel(netkit.graph.Graph, netkit.classifiers.DataSplit)
doEstimate
public boolean doEstimate(Node node,
double[] result)
- Estimate how near this node's neighborhood is to each of the class vectors using
a user-specified distance function (cosine by default) and normalize to produce
a pseudo distribution.
- Specified by:
doEstimate
in class NetworkClassifierImp
- 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
- See Also:
NetworkClassifierImp.makeVector(netkit.graph.Node, double[])
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object