Class LinearAggregator
- java.lang.Object
-
- it.unimi.di.big.mg4j.search.score.AbstractAggregator
-
- it.unimi.di.big.mg4j.search.score.LinearAggregator
-
- All Implemented Interfaces:
Scorer
,FlyweightPrototype<Scorer>
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
Fields Modifier and Type Field Description 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.-
Fields inherited from class it.unimi.di.big.mg4j.search.score.AbstractAggregator
actualSamples, currSample, currScore, documentIterator, n, needsCaching, sampleDocument, samples, sampleScore, scorer
-
-
Constructor Summary
Constructors Constructor Description LinearAggregator(Scorer[] scorer, double[] weight)
Creates a linear aggregator.
-
Method Summary
Modifier and Type Method Description LinearAggregator
copy()
protected double
score(double[] score)
Computes an aggregated score using the given array of basic scores.protected void
setupEqualizationFactors()
Sets up the equalisation factors.String
toString()
-
Methods inherited from class it.unimi.di.big.mg4j.search.score.AbstractAggregator
equalize, getWeights, nextDocument, score, score, setWeights, usesIntervals, wrap
-
-
-
-
Constructor Detail
-
LinearAggregator
public LinearAggregator(Scorer[] scorer, double[] weight)
Creates a linear aggregator.- Parameters:
scorer
- the array of scorers.weight
- the array of weights.
-
-
Method Detail
-
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 toAbstractAggregator.scorer
.- Specified by:
score
in classAbstractAggregator
- 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 classAbstractAggregator
-
-