netkit.classifiers.active
Class GreedyTruth

java.lang.Object
  extended by netkit.classifiers.active.PickLabelStrategyImp
      extended by netkit.classifiers.active.GreedyTruth
All Implemented Interfaces:
PickLabelStrategy, Configurable

public class GreedyTruth
extends PickLabelStrategyImp

Picks next labels by getting the best jump in accuracy, knowing what the truth is. This is used as the gold standard that noone should be able to beat. Right now, this assumes that we are using the harmonic function as the relational learner, because we can relatively efficiently compute the true accuracies.

Author:
sofmac

Nested Class Summary
 
Nested classes/interfaces inherited from interface netkit.classifiers.active.PickLabelStrategy
PickLabelStrategy.LabelNode
 
Field Summary
 
Fields inherited from class netkit.classifiers.active.PickLabelStrategyImp
iteration, logger
 
Constructor Summary
GreedyTruth()
           
 
Method Summary
 void configure(Configuration config)
           
 Configuration getDefaultConfiguration()
           
 java.lang.String getDescription()
           
 java.lang.String getName()
           
 double getRank(DataSplit split, Estimate predictions, Node node)
          Get the rank of the given node if the strategy were to pick the node.
 java.lang.String getShortName()
           
 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 split, Estimate predictions, int maxPicks)
          Get the list of nodes to get labels for...
protected  PickLabelStrategy.LabelNode[] pickNodes(Estimate predictions, int maxPicks)
          Get the next nodes to label based on the empirical risk minimization principle.
 
Methods inherited from class netkit.classifiers.active.PickLabelStrategyImp
getAverageRank, getAverageRank, getIterationNum, getNetworkLearner, getNodesToLabel, getSplit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GreedyTruth

public GreedyTruth()
Method Detail

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

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 datasplit
predictions - 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 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 datasplit
predictions - 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)

pickNodes

protected PickLabelStrategy.LabelNode[] pickNodes(Estimate predictions,
                                                  int maxPicks)
Get the next nodes to label based on the empirical risk minimization principle.

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.

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()