scratch.joshua.ranking
Class AbstractIterativeRanker

java.lang.Object
  extended by scratch.joshua.ranking.AbstractRanker
      extended by scratch.joshua.ranking.AbstractIterativeRanker
Direct Known Subclasses:
HITSRanker, SingleValueRanker

public abstract class AbstractIterativeRanker
extends AbstractRanker


Nested Class Summary
protected static class AbstractIterativeRanker.UniformIncident
           
protected static class AbstractIterativeRanker.UniformOut
           
 
Field Summary
protected  int max_iterations
           
protected  NumberVertexValue priors
           
protected  double tolerance
           
protected static EdgeVertexNumberFunction UNIFORM_INCIDENT
           
protected static NumberEdgeValue UNIFORM_OUT
           
 
Fields inherited from class scratch.joshua.ranking.AbstractRanker
edge_value, graph, UNIT_VALUE
 
Constructor Summary
AbstractIterativeRanker(ArchetypeGraph g, int max_iterations, double tolerance)
           
AbstractIterativeRanker(ArchetypeGraph g, NumberEdgeValue edge_value, int max_iterations, double tolerance)
           
AbstractIterativeRanker(ArchetypeGraph g, NumberVertexValue priors, int max_iterations, double tolerance)
           
AbstractIterativeRanker(ArchetypeGraph g, NumberVertexValue priors, NumberEdgeValue edge_value, int max_iterations, double tolerance)
           
 
Method Summary
protected static NumberVertexValue getNormalizedInitialValues(ArchetypeGraph g)
          Returns NumberVertexValue with uniformly distributed values such that their sum, over all vertices in g, is 1.
protected static NumberVertexValue getNormalizedInitialValues(ArchetypeGraph graph, boolean squared)
          Returns NumberVertexValue with uniformly distributed values such that their sum (of their squares if squared is true) over all vertices in g is 1.
 double getToleranceValue(double cur_tolerance, NumberVertexValue old_value, NumberVertexValue new_value)
          Returns the maximum of largest single difference between any value in old_value and the corresponding value in new_value.
protected  boolean hasConverged(ArchetypeVertex v, NumberVertexValue first, NumberVertexValue second)
           
 
Methods inherited from class scratch.joshua.ranking.AbstractRanker
normalizeValues, normalizeValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNIFORM_OUT

protected static final NumberEdgeValue UNIFORM_OUT

UNIFORM_INCIDENT

protected static final EdgeVertexNumberFunction UNIFORM_INCIDENT

priors

protected NumberVertexValue priors

max_iterations

protected int max_iterations

tolerance

protected double tolerance
Constructor Detail

AbstractIterativeRanker

public AbstractIterativeRanker(ArchetypeGraph g,
                               int max_iterations,
                               double tolerance)

AbstractIterativeRanker

public AbstractIterativeRanker(ArchetypeGraph g,
                               NumberVertexValue priors,
                               int max_iterations,
                               double tolerance)

AbstractIterativeRanker

public AbstractIterativeRanker(ArchetypeGraph g,
                               NumberEdgeValue edge_value,
                               int max_iterations,
                               double tolerance)

AbstractIterativeRanker

public AbstractIterativeRanker(ArchetypeGraph g,
                               NumberVertexValue priors,
                               NumberEdgeValue edge_value,
                               int max_iterations,
                               double tolerance)
Method Detail

getToleranceValue

public double getToleranceValue(double cur_tolerance,
                                NumberVertexValue old_value,
                                NumberVertexValue new_value)
Returns the maximum of largest single difference between any value in old_value and the corresponding value in new_value. Override this if you want to calculate the tolerance value in a different way (e.g., mean difference over all vertices).

Parameters:
cur_tolerance -
old_value -
new_value -
Returns:

hasConverged

protected boolean hasConverged(ArchetypeVertex v,
                               NumberVertexValue first,
                               NumberVertexValue second)

getNormalizedInitialValues

protected static NumberVertexValue getNormalizedInitialValues(ArchetypeGraph graph,
                                                              boolean squared)
Returns NumberVertexValue with uniformly distributed values such that their sum (of their squares if squared is true) over all vertices in g is 1.


getNormalizedInitialValues

protected static NumberVertexValue getNormalizedInitialValues(ArchetypeGraph g)
Returns NumberVertexValue with uniformly distributed values such that their sum, over all vertices in g, is 1.