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.bipartite.BipartiteRecommender<U>
es.uam.eps.ir.relison.links.recommendation.algorithms.standalone.bipartite.MaximumCosineSimilarity<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 MaximumCosineSimilarity<U>
extends BipartiteRecommender<U>
Recommender. This method computes all the similarities between the authorities, and scores recommended contacts by the maximum similarity over the authorities that the target user is currently following.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private java.util.Map<U,​cern.colt.matrix.DoubleMatrix1D> authVectors
    Vectorial representation of the authorities
    private java.util.Map<java.lang.Long,​java.lang.Integer> hubIdx
    Identifiers of the hubs.
    private java.util.Map<U,​java.lang.Double> normVectors
    Norms of the vectors.
    private it.unimi.dsi.fastutil.objects.Object2DoubleMap<Pair<U>> similarities
    Similarities between pairs of users.

    Fields inherited from class es.uam.eps.ir.relison.links.recommendation.algorithms.standalone.bipartite.BipartiteRecommender

    authorities, bipartiteGraph, hubs, mode

    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
    MaximumCosineSimilarity​(FastGraph<U> graph)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    private double computeVector​(long auth, cern.colt.matrix.DoubleMatrix1D vector)
    Computes the vector for an authority
    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

    • authVectors

      private final java.util.Map<U,​cern.colt.matrix.DoubleMatrix1D> authVectors
      Vectorial representation of the authorities
    • normVectors

      private final java.util.Map<U,​java.lang.Double> normVectors
      Norms of the vectors.
    • hubIdx

      private final java.util.Map<java.lang.Long,​java.lang.Integer> hubIdx
      Identifiers of the hubs.
    • similarities

      private final it.unimi.dsi.fastutil.objects.Object2DoubleMap<Pair<U>> similarities
      Similarities between pairs of users.
  • Constructor Details

  • 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>
    • computeVector

      private double computeVector​(long auth, cern.colt.matrix.DoubleMatrix1D vector)
      Computes the vector for an authority
      Parameters:
      auth - The identifier of the authority
      vector - The vector
      Returns:
      The norm of the vector (L2 norm)