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 intkThe number of neighbors to select.private UpdateableGraphSimilaritysimUpdateable 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.Int2DoubleMapgetScoresMap(int uidx)Returns a map of item-score pairs.voidupdate(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.voidupdate(U u, U v, double val)Updates the values of the recommender, considering that a new rating has been added.voidupdateAddItem(U u)Updates the values of the recommender, considering that a new item has been added.voidupdateAddUser(U u)Updates the values of the recommender, considering that a new user has been added.voidupdateDelete(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.voidupdateDelete(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
getRecommendationMethods 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, user2uidxMethods inherited from class es.uam.eps.ir.ranksys.rec.AbstractRecommender
getRecommendation, getRecommendationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:FastUpdateableRankingRecommenderReturns a map of item-score pairs.- Specified by:
getScoresMapin 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:UpdateableRecommenderUpdates 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:UpdateableRecommenderUpdates 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:UpdateableRecommenderUpdates 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:UpdateableRecommenderUpdates 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:UpdateableRecommenderUpdates 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:UpdateableRecommenderUpdates the values of the recommender, considering that a rating has been deleted.- Parameters:
u- the user.u2- the item.val- the value.
-