Class LocalLambdaReranker<U,I>
java.lang.Object
es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalReranker<U,I>
es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalGreedyReranker<U,I>
es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalLambdaReranker<U,I>
- Type Parameters:
U
- type of the users.I
- type of the items.
- All Implemented Interfaces:
GlobalReranker<U,I>
- Direct Known Subclasses:
GraphLocalReranker
,LocalRandomReranker
public abstract class LocalLambdaReranker<U,I> extends LocalGreedyReranker<U,I>
Generalization of local greedy reranking strategies, for processing several recommendations at a time.
These rerankers, given a set of recommendations, sequentially process them one by one. Those
recommendations which are processed later are aware of the previously processed recommendations.
They jointly optimize the accuracy and the novelty/diversity of the recommendations, by establishing a trade-off
between them.
-
Field Summary
Fields Modifier and Type Field Description private double
lambda
Trade-off between the original and novelty scoresprivate java.util.function.Supplier<Normalizer<I>>
norm
True if the scores have to be normalized, false if not.protected it.unimi.dsi.fastutil.objects.Object2DoubleMap<I>
novMap
Map containing the novelty of the items.protected Normalizer<I>
novStats
Statistics for the novelty scoresprotected Normalizer<I>
relStats
Statistics for the original scores.Fields inherited from class es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalGreedyReranker
cutOff
-
Constructor Summary
Constructors Constructor Description LocalLambdaReranker(int cutOff, double lambda, java.util.function.Supplier<Normalizer<I>> norm)
Constructor.LocalLambdaReranker(int cutOff, double lambda, java.util.function.Supplier<Normalizer<I>> norm, int seed)
Constructor. -
Method Summary
Modifier and Type Method Description protected abstract double
nov(U u, org.ranksys.core.util.tuples.Tuple2od<I> itemValue)
Novelty score.protected int[]
rerankPermutation(es.uam.eps.ir.ranksys.core.Recommendation<U,I> rec, int maxLength)
Given a recommendation, permutates it according to the given criteriaprotected int
selectItem(U u, it.unimi.dsi.fastutil.ints.IntSortedSet remainingI, java.util.List<org.ranksys.core.util.tuples.Tuple2od<I>> list)
Selects the next item to add in the permutationprotected double
value(org.ranksys.core.util.tuples.Tuple2od<I> iv)
Computes the value for an itemMethods inherited from class es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalGreedyReranker
getBasePerm, rerankRecommendation, update
Methods inherited from class es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalReranker
rerankRecommendations, update
-
Field Details
-
Constructor Details
-
LocalLambdaReranker
public LocalLambdaReranker(int cutOff, double lambda, java.util.function.Supplier<Normalizer<I>> norm)Constructor.- Parameters:
cutOff
- maximum length of the definitive ranking.lambda
- trade-off between the original and novelty scoresnorm
- the normalization strategy.
-
LocalLambdaReranker
public LocalLambdaReranker(int cutOff, double lambda, java.util.function.Supplier<Normalizer<I>> norm, int seed)Constructor.- Parameters:
cutOff
- maximum length of the definitive ranking.lambda
- trade-off between the original and novelty scoresnorm
- the normalization strategy.seed
- the random seed.
-
-
Method Details
-
rerankPermutation
protected int[] rerankPermutation(es.uam.eps.ir.ranksys.core.Recommendation<U,I> rec, int maxLength)Description copied from class:LocalGreedyReranker
Given a recommendation, permutates it according to the given criteria- Overrides:
rerankPermutation
in classLocalGreedyReranker<U,I>
- Parameters:
rec
- original recommendationmaxLength
- the maximum length of the definitive rankings- Returns:
- the permutation
-
value
Description copied from class:LocalGreedyReranker
Computes the value for an item- Specified by:
value
in classLocalGreedyReranker<U,I>
- Parameters:
iv
- The item, along its original value.- Returns:
- the value.
-
selectItem
protected int selectItem(U u, it.unimi.dsi.fastutil.ints.IntSortedSet remainingI, java.util.List<org.ranksys.core.util.tuples.Tuple2od<I>> list)Description copied from class:LocalGreedyReranker
Selects the next item to add in the permutation- Overrides:
selectItem
in classLocalGreedyReranker<U,I>
- Parameters:
u
- the user.remainingI
- remaining items for user ulist
- the list of scored items.- Returns:
- the next item.
-
nov
Novelty score.- Parameters:
u
- the target user.itemValue
- the recommended item and its recommendation score.- Returns:
- the novelty for this pair user-item.
-