netkit.classifiers.active
Class PickLabelStrategyImp

java.lang.Object
  extended by netkit.classifiers.active.PickLabelStrategyImp
All Implemented Interfaces:
PickLabelStrategy, Configurable
Direct Known Subclasses:
ComparatorLabeler, EmpiricalRiskMinimization, EmpiricalRiskMinimizationHarmonic, ERMHybrid, GraphCentralityLabeling, GreedyTruth, RandomLabeling, UncertaintyLabeling

public abstract class PickLabelStrategyImp
extends java.lang.Object
implements PickLabelStrategy


Nested Class Summary
 
Nested classes/interfaces inherited from interface netkit.classifiers.active.PickLabelStrategy
PickLabelStrategy.LabelNode
 
Field Summary
protected  int iteration
           
protected  java.util.logging.Logger logger
           
 
Constructor Summary
PickLabelStrategyImp()
           
 
Method Summary
 void configure(Configuration config)
           
protected  double getAverageRank(java.util.List<? extends PickLabelStrategy.LabelNode> sortedlist, int targetIndex)
           
protected  double getAverageRank(java.util.List<? extends PickLabelStrategy.LabelNode> list, PickLabelStrategy.LabelNode target)
           
 Configuration getDefaultConfiguration()
           
 int getIterationNum()
           
 NetworkLearner getNetworkLearner()
           
 PickLabelStrategy.LabelNode[] getNodesToLabel(DataSplit currentSplit, Estimate currentPredictions, int maxPicks)
          Get the list of nodes to get labels for.
 double getRank(DataSplit currentSplit, Estimate currentPredictions, Node node)
          Get the rank of the given node if the strategy were to pick the node.
 DataSplit getSplit()
           
 void initialize(NetworkLearner nl, DataSplit split)
          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.
 PickLabelStrategy.LabelNode[] peek(DataSplit currentSplit, Estimate currentPredictions, int numPeek)
          Get the list of nodes to get labels for...
protected abstract  PickLabelStrategy.LabelNode[] pickNodes(Estimate predictions, int maxPicks)
          Get the list of nodes to get labels for.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface netkit.classifiers.active.PickLabelStrategy
getDescription, getName, getShortName
 

Field Detail

logger

protected final java.util.logging.Logger logger

iteration

protected int iteration
Constructor Detail

PickLabelStrategyImp

public PickLabelStrategyImp()
Method Detail

pickNodes

protected abstract PickLabelStrategy.LabelNode[] pickNodes(Estimate predictions,
                                                           int maxPicks)
Get the list of nodes to get labels for.

Parameters:
currentPredictions - Current predictions of the classifier
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.

configure

public void configure(Configuration config)
Specified by:
configure in interface Configurable

getDefaultConfiguration

public Configuration getDefaultConfiguration()
Specified by:
getDefaultConfiguration in interface Configurable

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
Parameters:
nl - The NetworkLearner object that will be calling this strategy.
split - The initial train/test split that this will be used on

getSplit

public final DataSplit getSplit()

getIterationNum

public final int getIterationNum()

getNetworkLearner

public final NetworkLearner getNetworkLearner()

peek

public PickLabelStrategy.LabelNode[] peek(DataSplit currentSplit,
                                          Estimate currentPredictions,
                                          int numPeek)
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
Parameters:
currentSplit - Current datasplit
currentPredictions - Current predictions of the classifier
Returns:
An array of Node objects that should receive labels. null is returned if done.

getRank

public double getRank(DataSplit currentSplit,
                      Estimate currentPredictions,
                      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
Parameters:
currentSplit - Current datasplit
currentPredictions - Current predictions of the classifier
node - 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)

getAverageRank

protected double getAverageRank(java.util.List<? extends PickLabelStrategy.LabelNode> list,
                                PickLabelStrategy.LabelNode target)

getAverageRank

protected double getAverageRank(java.util.List<? extends PickLabelStrategy.LabelNode> sortedlist,
                                int targetIndex)

getNodesToLabel

public final PickLabelStrategy.LabelNode[] getNodesToLabel(DataSplit currentSplit,
                                                           Estimate currentPredictions,
                                                           int maxPicks)
Get the list of nodes to get labels for.

Specified by:
getNodesToLabel in interface PickLabelStrategy
Parameters:
currentSplit - Current predictions of the classifier
currentPredictions - Current predictions of the classifier
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.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object