it.unimi.dsi.mg4j.search.score
Class LinearAggregator
java.lang.Object
it.unimi.dsi.fastutil.ints.AbstractIntIterator
it.unimi.dsi.mg4j.search.score.AbstractAggregator
it.unimi.dsi.mg4j.search.score.LinearAggregator
- All Implemented Interfaces:
- IntIterator, FlyweightPrototype<Scorer>, Scorer, Iterator<Integer>
public class LinearAggregator
- extends AbstractAggregator
An aggregator that computes a linear combination of the component scorers.
This class requires, beside the usually array of scorers, a parallel array
of weights (not to be confused with
index weights
).
The score from each scorer will be multiplied by the respective weight, and the
overal score will be the sum of these values. Equalisation, if necessary, if performed
by maximising over the sample scores and dividing all scores by the resulting value.
Field Summary |
protected double[] |
equalisationFactor
The equalisation factors for each scorer (all set to one if no equalisation is required). |
protected double[] |
weight
The weights of each scorer. |
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterator |
skip |
weight
protected final double[] weight
- The weights of each scorer.
equalisationFactor
protected final double[] equalisationFactor
- The equalisation factors for each scorer (all set to one if no equalisation is required).
LinearAggregator
public LinearAggregator(Scorer[] scorer,
double[] weight)
- Creates a linear aggregator.
- Parameters:
scorer
- the array of scorers.weight
- the array of weights.
copy
public LinearAggregator copy()
score
protected double score(double[] score)
- Description copied from class:
AbstractAggregator
- Computes an aggregated score using the given array of basic scores.
The array is parallel to
AbstractAggregator.scorer
.
- Specified by:
score
in class AbstractAggregator
- Parameters:
score
- an array of scores.
- Returns:
- the aggregated scorer.
setupEqualizationFactors
protected void setupEqualizationFactors()
- Description copied from class:
AbstractAggregator
- Sets up the equalisation factors.
Implementations should look into AbstractAggregator.sampleScore
and set up the
equalisation logic. Note that this method is responsible for setting
up appropriate equalisation factors even if no equalisation is required
(e.g., setting all factors to 1 ).
- Specified by:
setupEqualizationFactors
in class AbstractAggregator
toString
public String toString()
- Overrides:
toString
in class Object