java.lang.Object
es.uam.eps.ir.ranksys.rec.AbstractRecommender<U,​I>
es.uam.eps.ir.ranksys.rec.fast.AbstractFastRecommender<U,​I>
es.uam.eps.ir.ranksys.rec.fast.FastRankingRecommender<U,​U>
es.uam.eps.ir.relison.links.recommendation.UserFastRankingRecommender<U>
es.uam.eps.ir.relison.links.recommendation.algorithms.standalone.randomwalk.PurePersonalizedPageRank<U>
Type Parameters:
U - type of the users.
All Implemented Interfaces:
es.uam.eps.ir.ranksys.core.index.ItemIndex<U>, es.uam.eps.ir.ranksys.core.index.UserIndex<U>, es.uam.eps.ir.ranksys.fast.index.FastItemIndex<U>, es.uam.eps.ir.ranksys.fast.index.FastUserIndex<U>, es.uam.eps.ir.ranksys.rec.fast.FastRecommender<U,​U>, es.uam.eps.ir.ranksys.rec.Recommender<U,​U>

public class PurePersonalizedPageRank<U>
extends UserFastRankingRecommender<U>
Recommender algorithm based in a modified Personalized PageRank.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private double lambda
    The teleport rate
    private static int MAXITER
    Maximum number of iterations.
    private boolean S2U
    Indicates if teleports always go to the origin node.
    private boolean simple
    In case it is true, the target node (or root/origin node) can only be accessed via teleport by a random walker.
    private static double THRESHOLD
    Convergence threshold.

    Fields inherited from class es.uam.eps.ir.relison.links.recommendation.UserFastRankingRecommender

    graph

    Fields inherited from class es.uam.eps.ir.ranksys.rec.fast.AbstractFastRecommender

    iIndex, uIndex
  • Constructor Summary

    Constructors 
    Constructor Description
    PurePersonalizedPageRank​(FastGraph<U> graph, double lambda, boolean simple, boolean S2U)
    Constructor
  • Method Summary

    Modifier and Type Method Description
    protected java.util.Map<U,​java.lang.Double> calculatePagerank​(U uId)
    Calculates the PageRank value
    it.unimi.dsi.fastutil.ints.Int2DoubleMap getScoresMap​(int i)  

    Methods inherited from class es.uam.eps.ir.relison.links.recommendation.UserFastRankingRecommender

    getFreq, getFreq, getGraph

    Methods inherited from class es.uam.eps.ir.ranksys.rec.fast.FastRankingRecommender

    getRecommendation

    Methods inherited from class es.uam.eps.ir.ranksys.rec.fast.AbstractFastRecommender

    getRecommendation, getRecommendation, getRecommendation, getRecommendation, getRecommendation, getRecommendation, getRecommendation, iidx2item, item2iidx, numItems, numUsers, uidx2user, user2uidx

    Methods inherited from class es.uam.eps.ir.ranksys.rec.AbstractRecommender

    getRecommendation, getRecommendation

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface es.uam.eps.ir.ranksys.fast.index.FastItemIndex

    containsItem, getAllIidx, getAllItems, iidx2item, iidx2item, item2iidx, item2iidx

    Methods inherited from interface es.uam.eps.ir.ranksys.fast.index.FastUserIndex

    containsUser, getAllUidx, getAllUsers, uidx2user, uidx2user, user2uidx, user2uidx

    Methods inherited from interface es.uam.eps.ir.ranksys.rec.Recommender

    getRecommendation, getRecommendation
  • Field Details

    • simple

      private final boolean simple
      In case it is true, the target node (or root/origin node) can only be accessed via teleport by a random walker. In other case, with some probability, the node can be accessed by its incoming neighbors.
    • S2U

      private final boolean S2U
      Indicates if teleports always go to the origin node. In case it is false, when the random walker arrives to a sink, it might teleport to the any of the other nodes.
    • lambda

      private final double lambda
      The teleport rate
    • THRESHOLD

      private static final double THRESHOLD
      Convergence threshold.
      See Also:
      Constant Field Values
    • MAXITER

      private static final int MAXITER
      Maximum number of iterations.
      See Also:
      Constant Field Values
  • Constructor Details

    • PurePersonalizedPageRank

      public PurePersonalizedPageRank​(FastGraph<U> graph, double lambda, boolean simple, boolean S2U)
      Constructor
      Parameters:
      graph - the original graph.
      lambda - the teleport rate.
      simple - indicates if the target node can only be accessed via teleport or not.
      S2U - Indicates if teleports always go to the origin node.
  • Method Details

    • getScoresMap

      public it.unimi.dsi.fastutil.ints.Int2DoubleMap getScoresMap​(int i)
      Specified by:
      getScoresMap in class es.uam.eps.ir.ranksys.rec.fast.FastRankingRecommender<U,​U>
    • calculatePagerank

      protected java.util.Map<U,​java.lang.Double> calculatePagerank​(U uId)
      Calculates the PageRank value
      Parameters:
      uId - root node.
      Returns:
      The PageRank value for all the nodes.