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 scores
    private 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 scores
    protected 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 criteria
    protected 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 permutation
    protected double value​(org.ranksys.core.util.tuples.Tuple2od<I> iv)
    Computes the value for an item

    Methods 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • relStats

      protected Normalizer<I> relStats
      Statistics for the original scores.
    • novStats

      protected Normalizer<I> novStats
      Statistics for the novelty scores
    • novMap

      protected it.unimi.dsi.fastutil.objects.Object2DoubleMap<I> novMap
      Map containing the novelty of the items.
    • lambda

      private final double lambda
      Trade-off between the original and novelty scores
    • norm

      private final java.util.function.Supplier<Normalizer<I>> norm
      True if the scores have to be normalized, false if not.
  • 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 scores
      norm - 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 scores
      norm - 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 class LocalGreedyReranker<U,​I>
      Parameters:
      rec - original recommendation
      maxLength - the maximum length of the definitive rankings
      Returns:
      the permutation
    • value

      protected double value​(org.ranksys.core.util.tuples.Tuple2od<I> iv)
      Description copied from class: LocalGreedyReranker
      Computes the value for an item
      Specified by:
      value in class LocalGreedyReranker<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 class LocalGreedyReranker<U,​I>
      Parameters:
      u - the user.
      remainingI - remaining items for user u
      list - the list of scored items.
      Returns:
      the next item.
    • nov

      protected abstract double nov​(U u, org.ranksys.core.util.tuples.Tuple2od<I> itemValue)
      Novelty score.
      Parameters:
      u - the target user.
      itemValue - the recommended item and its recommendation score.
      Returns:
      the novelty for this pair user-item.