java.lang.Object
es.uam.eps.ir.relison.links.recommendation.reranking.global.local.LocalReranker<U,​I>
Type Parameters:
U - type of the users.
I - type of the items.
All Implemented Interfaces:
GlobalReranker<U,​I>
Direct Known Subclasses:
LocalGreedyReranker

public abstract class LocalReranker<U,​I>
extends java.lang.Object
implements GlobalReranker<U,​I>
Generalization of local 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.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private long seed
    Random number generator seed.
  • Constructor Summary

    Constructors 
    Constructor Description
    LocalReranker()
    Constructor.
    LocalReranker​(long seed)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    protected abstract es.uam.eps.ir.ranksys.core.Recommendation<U,​I> rerankRecommendation​(es.uam.eps.ir.ranksys.core.Recommendation<U,​I> rec, int maxLength)
    Given a recommendation, reranks it.
    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 abstract void update​(es.uam.eps.ir.ranksys.core.Recommendation<U,​I> reranked)
    Updates the values, given a new recommendation.

    Methods inherited from class java.lang.Object

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

    • seed

      private final long seed
      Random number generator seed.
  • Constructor Details

    • LocalReranker

      public LocalReranker()
      Constructor.
    • LocalReranker

      public LocalReranker​(long seed)
      Constructor.
      Parameters:
      seed - random number generator 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 interface GlobalReranker<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.
    • update

      protected abstract void update​(es.uam.eps.ir.ranksys.core.Recommendation<U,​I> reranked)
      Updates the values, given a new recommendation.
      Parameters:
      reranked - the reranked recommendation.
    • rerankRecommendation

      protected abstract es.uam.eps.ir.ranksys.core.Recommendation<U,​I> rerankRecommendation​(es.uam.eps.ir.ranksys.core.Recommendation<U,​I> rec, int maxLength)
      Given a recommendation, reranks it.
      Parameters:
      rec - the recommendation to rerank.
      maxLength - number of items to take from the original recommendation.
      Returns:
      the updated recommendation.