/**
   * Get a user's ratings.
   *
   * @param user The user ID.
   * @return The ratings to retrieve.
   */
  private SparseVector getUserRatingVector(long user) {
    UserHistory<Rating> history = userEvents.getEventsForUser(user, Rating.class);
    if (history == null) {
      history = History.forUser(user);
    }

    return RatingVectorUserHistorySummarizer.makeRatingVector(history);
  }
예제 #2
0
  /**
   * It is used to generate rating list from UserEventDAO.
   *
   * @param uid The user ID.
   * @param dao The UserEventDAO.
   * @return The VectorEntry list of rating.
   */
  private SparseVector makeUserVector(long uid, UserEventDAO dao) {
    UserHistory<Rating> history = dao.getEventsForUser(uid, Rating.class);
    SparseVector vector = null;
    if (history != null) {
      vector = RatingVectorUserHistorySummarizer.makeRatingVector(history);
    }

    return vector;
  }
예제 #3
0
 @Override
 protected TestUser getUserResults(long uid) {
   Preconditions.checkState(recommender != null, "recommender not built");
   UserHistory<Event> userData = userEvents.getEventsForUser(uid);
   return new LenskitTestUser(recommender, userData);
 }