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.twitter.TwitterRecommender<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>
Direct Known Subclasses:
Love, Money, TwitterAverageCosineSimilarity, TwitterCentroidCosineSimilarity, TwitterMaximumCosineSimilarity

public abstract class TwitterRecommender<U>
extends UserFastRankingRecommender<U>
Twitter-based recommender. Following the details disclosed by Twitter about their contact recommendation approaches, these algorithms:
  1. for the target user, compute a reduced bipartite training graph.
    • Left side: a circle of trust of the users (nodes with greater pers. PageRank value)
    • Right side: the adjacent nodes to those in the left side
  2. use a given recommendation (bipartite) algorithm to finish.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.Map<U,​FastGraph<U>> circles
    Reduced training graphs.
    private int circlesize
    Size of the circle of trust
    private double r
    Teleport rate for the circle f trust computation.
    protected RecommenderSupplier<U> supplier
    The recommender supplier

    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
    TwitterRecommender​(FastGraph<U> graph, int circlesize, double r, RecommenderSupplier<U> supplier)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    private java.util.Set<U> getCircleOfTrust​(U u)
    Computes the circle of trust for a single user.
    it.unimi.dsi.fastutil.ints.Int2DoubleMap getScoresMap​(int uIdx)  
    private FastGraph<U> trainingGraph​(java.util.Set<U> nodes)
    Builds the training bipartite graph.
    private FastGraph<U> trainingGraph​(U u)
    Computes a reduced training graph

    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

    • circlesize

      private final int circlesize
      Size of the circle of trust
    • r

      private final double r
      Teleport rate for the circle f trust computation.
    • circles

      protected final java.util.Map<U,​FastGraph<U>> circles
      Reduced training graphs.
    • supplier

      protected final RecommenderSupplier<U> supplier
      The recommender supplier
  • Constructor Details

    • TwitterRecommender

      public TwitterRecommender​(FastGraph<U> graph, int circlesize, double r, RecommenderSupplier<U> supplier)
      Constructor.
      Parameters:
      graph - original graph.
      circlesize - size of the circle of trust.
      r - teleport rate for the personalized PageRank algorithm for computing the circle of trust.
      supplier - a supplier for the contact recommendation algorithm to apply in the reduced network.
  • Method Details

    • getCircleOfTrust

      private java.util.Set<U> getCircleOfTrust​(U u)
      Computes the circle of trust for a single user.
      Parameters:
      u - the user
      Returns:
      the circle of trust
    • trainingGraph

      private FastGraph<U> trainingGraph​(java.util.Set<U> nodes)
      Builds the training bipartite graph.
      Parameters:
      nodes - the set of nodes.
      Returns:
      the graph if everything goes well, false otherwise.
    • trainingGraph

      private FastGraph<U> trainingGraph​(U u)
      Computes a reduced training graph
      Parameters:
      u - user
      Returns:
      the reduced training graph for that user.
    • getScoresMap

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