netkit.classifiers.active.graphfunctions
Class ScoringFunction

java.lang.Object
  extended by netkit.classifiers.active.graphfunctions.ScoringFunction
All Implemented Interfaces:
java.util.Comparator<PickLabelStrategy.LabelNode>
Direct Known Subclasses:
Closeness, ClusterCloseness, ClusterWeightedCloseness, ERMRank, ReverseScoringFunction, WeightedCloseness

public abstract class ScoringFunction
extends java.lang.Object
implements java.util.Comparator<PickLabelStrategy.LabelNode>


Field Summary
protected  GraphMetrics gm
           
protected  GraphCentralityLabeling labeler
           
protected  Classification labels
           
 
Constructor Summary
ScoringFunction()
           
 
Method Summary
 double bestScore()
          What is the best score (first to be picked)
 boolean clusterBased()
          Is this scoring function cluster based (does it need clustering).
 int compare(double d1, double d2)
          Standard comparator function.
 int compare(PickLabelStrategy.LabelNode n1, PickLabelStrategy.LabelNode n2)
          Standard comparator function.
 void initialize(GraphCentralityLabeling graphLabeler)
           
abstract  double score(ModularityClusterer.Cluster c, Node n)
           
abstract  java.lang.String toString()
           
 double update(ModularityClusterer.Cluster c, double currentScore, Node n, Node[] newPicks)
          Return the new score of a node given its old score and a newly labeled node.
 boolean updateable()
          returns whether the score of a node will change if more nodes are labeled.
 double worstScore()
          What is the best score (last to be picked)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

labeler

protected GraphCentralityLabeling labeler

gm

protected GraphMetrics gm

labels

protected Classification labels
Constructor Detail

ScoringFunction

public ScoringFunction()
Method Detail

initialize

public void initialize(GraphCentralityLabeling graphLabeler)

toString

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

score

public abstract double score(ModularityClusterer.Cluster c,
                             Node n)

update

public double update(ModularityClusterer.Cluster c,
                     double currentScore,
                     Node n,
                     Node[] newPicks)
Return the new score of a node given its old score and a newly labeled node. By default a scoring function is not updateable and will just return the current score.

Returns:
the current score.

updateable

public boolean updateable()
returns whether the score of a node will change if more nodes are labeled. The default is that a scoring function is not updateable.

Returns:
false.

clusterBased

public boolean clusterBased()
Is this scoring function cluster based (does it need clustering).

Returns:
false (default)

compare

public final int compare(PickLabelStrategy.LabelNode n1,
                         PickLabelStrategy.LabelNode n2)
Standard comparator function. Calls the compare on doubles.

Specified by:
compare in interface java.util.Comparator<PickLabelStrategy.LabelNode>

compare

public int compare(double d1,
                   double d2)
Standard comparator function. Return reverse natural order by default to ensure that the 'best' score (=smallest) is at the end of the list (first to be picked).


bestScore

public double bestScore()
What is the best score (first to be picked)


worstScore

public double worstScore()
What is the best score (last to be picked)