netkit.classifiers.active
Class GraphCentralityLabeling
java.lang.Object
netkit.classifiers.active.PickLabelStrategyImp
netkit.classifiers.active.GraphCentralityLabeling
- All Implemented Interfaces:
- PickLabelStrategy, Configurable
public class GraphCentralityLabeling
- extends PickLabelStrategyImp
Graph Centrality Labeling for Active Learning iteratively picks central nodes in a
graph that are in clusters that have no known labels. It uses a modularity based
clustering algorithm to iteratively cluster a graph into smaller and smaller
clusters until it finds a cluster that has no currently known labels. It then
picks the most central node in that cluster.
Various centrality metric strategies are possible (using the metric
configuration variable):
metric
--- name of the class (full class name or stem if in the netkit.classifiers.active.graphfunctions
package)
useClustering=[true|false]
-- cluster graph and find central nodes in each cluster?
If clustering is turned on, then various cluster-ranking functions are available (after
using the centrality metric to identify the node in the cluster). The cluster rank
function is specified using the clusterrank
configuration variable. By
default, the rank is the same as the centrality metric.
clusterRank
--- name of the class (full class name or stem if in the netkit.classifiers.active.graphfunctions
package)
nodesPerCluster
--- keep the topk list in each cluster and return those as well (first topk from first cluster, then iteratively through the next clusters). default topk=1
- Author:
- sofmac
- See Also:
netkit.graph.ModularityClusterer
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
GraphCentralityLabeling
public GraphCentralityLabeling()
getInstance
public static GraphCentralityLabeling getInstance(java.lang.String metric,
java.lang.String rank,
double nodesPerCluster)
getDefaultConfiguration
public Configuration getDefaultConfiguration()
- Specified by:
getDefaultConfiguration
in interface Configurable
- Overrides:
getDefaultConfiguration
in class PickLabelStrategyImp
configure
public void configure(Configuration config)
- Specified by:
configure
in interface Configurable
- Overrides:
configure
in class PickLabelStrategyImp
getMetrics
public GraphMetrics getMetrics()
getLabels
public Classification getLabels()
getHarmonicFunction
public Harmonic getHarmonicFunction()
initialize
public void initialize(NetworkLearner nl,
DataSplit split)
- Description copied from interface:
PickLabelStrategy
- Initialize the label strategy by providing a reference to the NetworkLeaner
object that calls the strategy, thereby giving it access to all information
it is likely to need. This should re-initialize the strategy if
it has any cached values from prior calls.
- Specified by:
initialize
in interface PickLabelStrategy
- Overrides:
initialize
in class PickLabelStrategyImp
- Parameters:
nl
- The NetworkLearner object that will be calling this strategy.split
- The initial train/test split that this will be used on
getDescription
public java.lang.String getDescription()
getName
public java.lang.String getName()
getShortName
public java.lang.String getShortName()
printStat
protected void printStat(java.lang.String title)
getRank
public double getRank(DataSplit split,
Estimate predictions,
Node node)
- Description copied from interface:
PickLabelStrategy
- Get the rank of the given node if the strategy were to pick the node.
If more than one node has the same score, then average their ranks (hence a double is returned)
- Specified by:
getRank
in interface PickLabelStrategy
- Overrides:
getRank
in class PickLabelStrategyImp
- Parameters:
split
- Current datasplitpredictions
- Current predictions of the classifiernode
- the node whose rank is requested
- Returns:
- the rank of the given node or Double.NaN if the node is not in the rankings. If more than one node has the same score, then average their ranks (hence a double is returned)
peek
public PickLabelStrategy.LabelNode[] peek(DataSplit split,
Estimate predictions,
int maxPicks)
- Description copied from interface:
PickLabelStrategy
- Get the list of nodes to get labels for... without changing the internal state of the
active labeler.
- Specified by:
peek
in interface PickLabelStrategy
- Overrides:
peek
in class PickLabelStrategyImp
- Parameters:
split
- Current datasplitpredictions
- Current predictions of the classifier
- Returns:
- An array of Node objects that should receive labels.
null
is returned if done.
pickNodes
protected PickLabelStrategy.LabelNode[] pickNodes(Estimate predictions,
int maxPicks)
- Picks the next nodes as the ones with the highest closeness centrality (normalized
by cluster size) in a cluster that has no known labels.
As it chooses new labels, it will split those clusters into two clusters: one
with a labeled example and one with no labeled examples.
- Specified by:
pickNodes
in class PickLabelStrategyImp
maxPicks
- how many nodes should it pick at maximum (this iteration)
- Returns:
- An array of Node objects that should receive labels.
null
is returned if done.