Class LocalRandomReranker<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>
es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalRandomReranker<U,I>
- Type Parameters:
U
- type of the users.I
- type of the items.
- All Implemented Interfaces:
GlobalReranker<U,I>
public class LocalRandomReranker<U,I> extends LocalLambdaReranker<U,I>
Random reranker. Reorders recommendations (gradually) at random.
+
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<U,java.util.Map<I,java.lang.Double>>
map
A map containing the random scores for the different user-item pairs.private int
seed
Random seed.Fields inherited from class es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalLambdaReranker
novMap, novStats, relStats
Fields inherited from class es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalGreedyReranker
cutOff
-
Constructor Summary
Constructors Constructor Description LocalRandomReranker(int cutOff, double lambda, java.util.function.Supplier<Normalizer<I>> norm)
Constructor.LocalRandomReranker(int cutOff, double lambda, java.util.function.Supplier<Normalizer<I>> norm, int seed)
Constructor. -
Method Summary
Modifier and Type Method Description protected double
nov(U u, org.ranksys.core.util.tuples.Tuple2od<I> itemValue)
Novelty score.java.util.stream.Stream<es.uam.eps.ir.ranksys.core.Recommendation<U,I>>
rerankRecommendations(java.util.stream.Stream<es.uam.eps.ir.ranksys.core.Recommendation<U,I>> recommendation, int maxLength)
Reranks a set of recommendations.protected void
update(es.uam.eps.ir.ranksys.core.Recommendation<U,I> reranked)
Updates the values, given a new recommendation.protected void
update(U user, org.ranksys.core.util.tuples.Tuple2od<I> bestItemValue)
Given a user, and the next value to add, updates the reranker parameters.Methods inherited from class es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalLambdaReranker
rerankPermutation, selectItem, value
Methods inherited from class es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalGreedyReranker
getBasePerm, rerankRecommendation
-
Field Details
-
Constructor Details
-
LocalRandomReranker
public LocalRandomReranker(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.
-
LocalRandomReranker
public LocalRandomReranker(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
-
rerankRecommendations
public java.util.stream.Stream<es.uam.eps.ir.ranksys.core.Recommendation<U,I>> rerankRecommendations(java.util.stream.Stream<es.uam.eps.ir.ranksys.core.Recommendation<U,I>> recommendation, int maxLength)Description copied from interface:GlobalReranker
Reranks a set of recommendations.- Specified by:
rerankRecommendations
in interfaceGlobalReranker<U,I>
- Overrides:
rerankRecommendations
in classLocalReranker<U,I>
- Parameters:
recommendation
- a stream containing all the recommendations to rerank.maxLength
- maximum length of the definitive ranking for each user.- Returns:
- a stream of recommendations containing the definitive rankings.
-
nov
Description copied from class:LocalLambdaReranker
Novelty score.- Specified by:
nov
in classLocalLambdaReranker<U,I>
- Parameters:
u
- the target user.itemValue
- the recommended item and its recommendation score.- Returns:
- the novelty for this pair user-item.
-
update
Description copied from class:LocalGreedyReranker
Given a user, and the next value to add, updates the reranker parameters.- Specified by:
update
in classLocalGreedyReranker<U,I>
- Parameters:
user
- The userbestItemValue
- The next value to add at the ranking
-
update
Description copied from class:LocalReranker
Updates the values, given a new recommendation.- Specified by:
update
in classLocalReranker<U,I>
- Parameters:
reranked
- the reranked recommendation.
-