Package es.uam.eps.ir.relison.links.data
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
-
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
-
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 preferencesuidxList
- list of lists of preferences by user indexiidxList
- list of lists of preferences by item indexuIndex
- 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 preferencesuidxList
- list of lists of preferences by user indexiidxList
- list of lists of preferences by item indexuIndex
- user indexuPrefFun
- user IdxPref to IdPref converter
-
-
Method Details
-
load
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 triplesuIndex
- user indexdirected
- indicates if the graph is directed or undirectedweighted
- 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 typeO
- additional information type- Parameters:
tuples
- stream of user-item-value-other tuplesuIdxPrefFun
- converts a tuple to a user IdxPrefuIndex
- user indexuIdPrefFun
- user IdxPref to IdPref converterdirected
- indicates if the graph is directed or undirectedweighted
- indicates if the graph is weighted or unweighted- Returns:
- an instance of SimpleFastPreferenceData containing the data from the input stream
-