Class GraphSimpleFastPreferenceData<U>

java.lang.Object
es.uam.eps.ir.ranksys.fast.preference.AbstractFastPreferenceData<U,​I>
org.ranksys.fast.preference.StreamsAbstractFastPreferenceData<U,​I>
es.uam.eps.ir.ranksys.fast.preference.SimpleFastPreferenceData<U,​U>
es.uam.eps.ir.relison.links.data.GraphSimpleFastPreferenceData<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.core.preference.PreferenceData<U,​U>, es.uam.eps.ir.ranksys.fast.index.FastItemIndex<U>, es.uam.eps.ir.ranksys.fast.index.FastUserIndex<U>, es.uam.eps.ir.ranksys.fast.preference.FastPreferenceData<U,​U>, java.io.Serializable, org.ranksys.core.preference.PointWisePreferenceData<U,​U>, org.ranksys.fast.preference.FastPointWisePreferenceData<U,​U>

public class GraphSimpleFastPreferenceData<U>
extends es.uam.eps.ir.ranksys.fast.preference.SimpleFastPreferenceData<U,​U>
Simple implementation of FastPreferenceData backed by nested lists.
See Also:
Serialized Form
  • Field Summary

    Fields inherited from class es.uam.eps.ir.ranksys.fast.preference.AbstractFastPreferenceData

    ii, iPrefFun, ui, uPrefFun
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected GraphSimpleFastPreferenceData​(int numPreferences, java.util.List<java.util.List<es.uam.eps.ir.ranksys.fast.preference.IdxPref>> uidxList, java.util.List<java.util.List<es.uam.eps.ir.ranksys.fast.preference.IdxPref>> iidxList, GraphIndex<U> uIndex)
    Constructor with default IdxPref to IdPref converter.
    protected GraphSimpleFastPreferenceData​(int numPreferences, java.util.List<java.util.List<es.uam.eps.ir.ranksys.fast.preference.IdxPref>> uidxList, java.util.List<java.util.List<es.uam.eps.ir.ranksys.fast.preference.IdxPref>> iidxList, GraphIndex<U> uIndex, java.util.function.Function<es.uam.eps.ir.ranksys.fast.preference.IdxPref,​es.uam.eps.ir.ranksys.core.preference.IdPref<U>> uPrefFun)
    Constructor with custom IdxPref to IdPref converter.
  • Method Summary

    Modifier and Type Method Description
    static <U> GraphSimpleFastPreferenceData<U> load​(FastGraph<U> graph)
    Loads the preferences from a file.
    static <U> GraphSimpleFastPreferenceData<U> load​(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple3<U,​U,​java.lang.Double>> tuples, GraphIndex<U> uIndex, boolean directed, boolean weighted)
    Loads a SimpleFastPreferenceData from a stream of user-item-value triples.
    static <U,​ O> GraphSimpleFastPreferenceData<U> load​(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple4<U,​U,​java.lang.Double,​O>> tuples, org.jooq.lambda.function.Function4<java.lang.Integer,​java.lang.Integer,​java.lang.Double,​O,​? extends es.uam.eps.ir.ranksys.fast.preference.IdxPref> uIdxPrefFun, GraphIndex<U> uIndex, java.util.function.Function<es.uam.eps.ir.ranksys.fast.preference.IdxPref,​es.uam.eps.ir.ranksys.core.preference.IdPref<U>> uIdPrefFun, boolean directed, boolean weighted)
    Loads a SimpleFastPreferenceData from a stream of user-item-value-other tuples.

    Methods inherited from class es.uam.eps.ir.ranksys.fast.preference.SimpleFastPreferenceData

    getIidxPreferences, getIidxWithPreferences, getPreference, getPreference, getUidxPreferences, getUidxWithPreferences, load, load, numItems, numItemsWithPreferences, numPreferences, numUsers, numUsersWithPreferences

    Methods inherited from class org.ranksys.fast.preference.StreamsAbstractFastPreferenceData

    getIidxUidxs, getIidxVs, getUidxIidxs, getUidxVs, useIteratorsPreferentially

    Methods inherited from class es.uam.eps.ir.ranksys.fast.preference.AbstractFastPreferenceData

    containsItem, containsUser, getAllItems, getAllUsers, getItemPreferences, getItemsWithPreferences, getUserPreferences, getUsersWithPreferences, iidx2item, item2iidx, numItems, numItems, numUsers, numUsers, uidx2user, user2uidx

    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, iidx2item, item2iidx, item2iidx, item2iidx

    Methods inherited from interface es.uam.eps.ir.ranksys.fast.preference.FastPreferenceData

    getIidxUidxs, getIidxVs, getUidxIidxs, getUidxVs, useIteratorsPreferentially

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

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

    Methods inherited from interface es.uam.eps.ir.ranksys.core.index.ItemIndex

    numItems

    Methods inherited from interface es.uam.eps.ir.ranksys.core.preference.PreferenceData

    getItemPreferences, getItemsWithPreferences, getUserPreferences, getUsersWithPreferences, numItems, numUsers

    Methods inherited from interface es.uam.eps.ir.ranksys.core.index.UserIndex

    numUsers
  • Constructor Details

    • GraphSimpleFastPreferenceData

      protected GraphSimpleFastPreferenceData​(int numPreferences, java.util.List<java.util.List<es.uam.eps.ir.ranksys.fast.preference.IdxPref>> uidxList, java.util.List<java.util.List<es.uam.eps.ir.ranksys.fast.preference.IdxPref>> iidxList, GraphIndex<U> uIndex)
      Constructor with default IdxPref to IdPref converter.
      Parameters:
      numPreferences - number of total preferences
      uidxList - list of lists of preferences by user index
      iidxList - list of lists of preferences by item index
      uIndex - user index
    • GraphSimpleFastPreferenceData

      protected GraphSimpleFastPreferenceData​(int numPreferences, java.util.List<java.util.List<es.uam.eps.ir.ranksys.fast.preference.IdxPref>> uidxList, java.util.List<java.util.List<es.uam.eps.ir.ranksys.fast.preference.IdxPref>> iidxList, GraphIndex<U> uIndex, java.util.function.Function<es.uam.eps.ir.ranksys.fast.preference.IdxPref,​es.uam.eps.ir.ranksys.core.preference.IdPref<U>> uPrefFun)
      Constructor with custom IdxPref to IdPref converter.
      Parameters:
      numPreferences - number of total preferences
      uidxList - list of lists of preferences by user index
      iidxList - list of lists of preferences by item index
      uIndex - user index
      uPrefFun - user IdxPref to IdPref converter
  • Method Details

    • load

      public static <U> GraphSimpleFastPreferenceData<U> load​(FastGraph<U> graph)
      Loads the preferences from a file.
      Type Parameters:
      U - Type of the users.
      Parameters:
      graph - the graph.
      Returns:
      the corresponding preference data.
    • load

      public static <U> GraphSimpleFastPreferenceData<U> load​(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple3<U,​U,​java.lang.Double>> tuples, GraphIndex<U> uIndex, boolean directed, boolean weighted)
      Loads a SimpleFastPreferenceData from a stream of user-item-value triples.
      Type Parameters:
      U - user type
      Parameters:
      tuples - stream of user-item-value triples
      uIndex - user index
      directed - indicates if the graph is directed or undirected
      weighted - indicates if the graph is weighted or unweighted
      Returns:
      an instance of SimpleFastPreferenceData containing the data from the input stream
    • load

      public static <U,​ O> GraphSimpleFastPreferenceData<U> load​(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple4<U,​U,​java.lang.Double,​O>> tuples, org.jooq.lambda.function.Function4<java.lang.Integer,​java.lang.Integer,​java.lang.Double,​O,​? extends es.uam.eps.ir.ranksys.fast.preference.IdxPref> uIdxPrefFun, GraphIndex<U> uIndex, java.util.function.Function<es.uam.eps.ir.ranksys.fast.preference.IdxPref,​es.uam.eps.ir.ranksys.core.preference.IdPref<U>> uIdPrefFun, boolean directed, boolean weighted)
      Loads a SimpleFastPreferenceData from a stream of user-item-value-other tuples. It can accomodate other information, thus you need to provide sub-classes of IdxPref IdPref accomodating for this new information.
      Type Parameters:
      U - user type
      O - additional information type
      Parameters:
      tuples - stream of user-item-value-other tuples
      uIdxPrefFun - converts a tuple to a user IdxPref
      uIndex - user index
      uIdPrefFun - user IdxPref to IdPref converter
      directed - indicates if the graph is directed or undirected
      weighted - indicates if the graph is weighted or unweighted
      Returns:
      an instance of SimpleFastPreferenceData containing the data from the input stream