Class UpdateableGraphCosineSimilarity

All Implemented Interfaces:
es.uam.eps.ir.ranksys.nn.sim.Similarity, UpdateableSimilarity

public class UpdateableGraphCosineSimilarity
extends UpdateableGraphSimilarity
Updateable version of the cosine similarity.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap norm2map
    A map for storing the norms.

    Fields inherited from class es.uam.eps.ir.relison.links.recommendation.algorithms.knn.similarities.GraphSimilarity

    graph
  • Constructor Summary

    Constructors 
    Constructor Description
    UpdateableGraphCosineSimilarity​(FastGraph<?> graph)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    java.util.stream.Stream<org.ranksys.core.util.tuples.Tuple2id> similarElems​(int uidx)  
    java.util.function.IntToDoubleFunction similarity​(int uidx)  
    it.unimi.dsi.fastutil.ints.IntList updateAdd​(int idx1, int idx2, double val)
    Updates the similarities between user/items after adding/modifying a rating.
    void updateAddElement()
    Updates the similarities between users/items after adding a new element.
    void updateDel​(int idx1, int idx2)
    Updates the similarities between users/items after removing a rating.

    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.nn.sim.Similarity

    similarity
  • Field Details

    • norm2map

      private final it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap norm2map
      A map for storing the norms.
  • Constructor Details

  • Method Details

    • updateAdd

      public it.unimi.dsi.fastutil.ints.IntList updateAdd​(int idx1, int idx2, double val)
      Description copied from interface: UpdateableSimilarity
      Updates the similarities between user/items after adding/modifying a rating.
      Parameters:
      idx1 - index of user
      idx2 - index of item
      val - rating value
      Returns:
      a pair which contains a) a list of users which have been fully updated b) a list of other updated similarities.
    • updateDel

      public void updateDel​(int idx1, int idx2)
      Description copied from interface: UpdateableSimilarity
      Updates the similarities between users/items after removing a rating.
      Parameters:
      idx1 - index of user
      idx2 - index of item
    • updateAddElement

      public void updateAddElement()
      Description copied from interface: UpdateableSimilarity
      Updates the similarities between users/items after adding a new element.
    • similarity

      public java.util.function.IntToDoubleFunction similarity​(int uidx)
    • similarElems

      public java.util.stream.Stream<org.ranksys.core.util.tuples.Tuple2id> similarElems​(int uidx)