Class UpdateableUBkNN<U>
java.lang.Object
es.uam.eps.ir.ranksys.rec.AbstractRecommender<U,I>
es.uam.eps.ir.relison.links.recommendation.updateable.fast.AbstractFastUpdateableRecommender<U,I>
es.uam.eps.ir.relison.links.recommendation.updateable.fast.FastUpdateableRankingRecommender<U,U>
es.uam.eps.ir.relison.links.recommendation.updateable.knn.user.UpdateableUBkNN<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>
,FastUpdateableRecommender<U,U>
,UpdateableRecommender<U,U>
public class UpdateableUBkNN<U> extends FastUpdateableRankingRecommender<U,U>
Updateable version of the user-based nearest-neighbors approach.
-
Field Summary
Fields Modifier and Type Field Description private int
k
The number of neighbors to select.private UpdateableGraphSimilarity
sim
Updateable similarity between pairs of users.Fields inherited from class es.uam.eps.ir.relison.links.recommendation.updateable.fast.AbstractFastUpdateableRecommender
prefData
-
Constructor Summary
Constructors Constructor Description UpdateableUBkNN(FastUpdateablePreferenceData<U,U> prefData, UpdateableGraphSimilarity similarity, int k)
Constructor. -
Method Summary
Modifier and Type Method Description it.unimi.dsi.fastutil.ints.Int2DoubleMap
getScoresMap(int uidx)
Returns a map of item-score pairs.void
update(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple3<U,U,java.lang.Double>> tuples)
Updates the values of the recommender, considering that the following preferences have been added.void
update(U u, U v, double val)
Updates the values of the recommender, considering that a new rating has been added.void
updateAddItem(U u)
Updates the values of the recommender, considering that a new item has been added.void
updateAddUser(U u)
Updates the values of the recommender, considering that a new user has been added.void
updateDelete(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple3<U,U,java.lang.Double>> tuples)
Updates the values of the recommender, considering that the following preferences have been removed.void
updateDelete(U u, U u2, double val)
Updates the values of the recommender, considering that a rating has been deleted.Methods inherited from class es.uam.eps.ir.relison.links.recommendation.updateable.fast.FastUpdateableRankingRecommender
getRecommendation
Methods inherited from class es.uam.eps.ir.relison.links.recommendation.updateable.fast.AbstractFastUpdateableRecommender
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
-
Field Details
-
Constructor Details
-
UpdateableUBkNN
public UpdateableUBkNN(FastUpdateablePreferenceData<U,U> prefData, UpdateableGraphSimilarity similarity, int k)Constructor.- Parameters:
prefData
- preference data.similarity
- an updateable similarity between pairs of users.k
- the number of neighbors to select.
-
-
Method Details
-
getScoresMap
public it.unimi.dsi.fastutil.ints.Int2DoubleMap getScoresMap(int uidx)Description copied from class:FastUpdateableRankingRecommender
Returns a map of item-score pairs.- Specified by:
getScoresMap
in classFastUpdateableRankingRecommender<U,U>
- Parameters:
uidx
- index of the user whose scores are predicted- Returns:
- a map of item-score pairs
-
update
public void update(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple3<U,U,java.lang.Double>> tuples)Description copied from interface:UpdateableRecommender
Updates the values of the recommender, considering that the following preferences have been added.- Parameters:
tuples
- the preferences which have been added.
-
updateDelete
public void updateDelete(java.util.stream.Stream<org.jooq.lambda.tuple.Tuple3<U,U,java.lang.Double>> tuples)Description copied from interface:UpdateableRecommender
Updates the values of the recommender, considering that the following preferences have been removed.- Parameters:
tuples
- the preferences which have been removed.
-
updateAddUser
Description copied from interface:UpdateableRecommender
Updates the values of the recommender, considering that a new user has been added.- Parameters:
u
- the user which has been added.
-
updateAddItem
Description copied from interface:UpdateableRecommender
Updates the values of the recommender, considering that a new item has been added.- Parameters:
u
- the item which has been added.
-
update
Description copied from interface:UpdateableRecommender
Updates the values of the recommender, considering that a new rating has been added.- Parameters:
u
- the user.v
- the itemval
- the value.
-
updateDelete
Description copied from interface:UpdateableRecommender
Updates the values of the recommender, considering that a rating has been deleted.- Parameters:
u
- the user.u2
- the item.val
- the value.
-