org.mymedialite.data
Interface IRatings

All Superinterfaces:
IDataSet
All Known Subinterfaces:
ITimedRatings
All Known Implementing Classes:
CombinedRatings, Ratings, RatingsProxy, StaticByteRatings, StaticFloatRatings, StaticRatings, TimedRatings, TimedRatingsProxy

public interface IRatings
extends IDataSet

Interface for rating datasets.


Method Summary
 void add(int user_id, int item_id, byte rating)
          Add byte-valued rating to the collection.
 void add(int user_id, int item_id, double rating)
          Add a new rating.
 void add(int user_id, int item_id, float rating)
          Add float-valued rating to the collection.
 double average()
          Average rating in the dataset.
 IntList countByItem()
          Get the rating count by item.
 IntList countByUser()
          Get the rating count by user.
 double get(int index)
          Directly access ratings.
 double get(int userId, int itemId)
          Directly access rating by user and item
 double get(int user_id, int item_id, IntCollection indexes)
          Directly access rating by user and item.
 double maxRating()
          Get the maximum rating in the dataset.
 double minRating()
          Get the minimum rating in the dataset.
 void removeAt(int index)
          Remove the rating at the specified index
 double set(int index, double rating)
          Directly access the ratings
 int size()
           
 java.lang.Double tryGet(int user_id, int item_id)
          Try to retrieve a rating for a given user-item combination.
 java.lang.Double tryGet(int user_id, int item_id, IntCollection indexes)
          Try to retrieve a rating for a given user-item combination.
 DoubleList values()
           
 
Methods inherited from interface org.mymedialite.data.IDataSet
allItems, allUsers, buildItemIndices, buildRandomIndex, buildUserIndices, byItem, byUser, getIndex, getIndex, getItems, getUsers, items, maxItemID, maxUserID, randomIndex, removeItem, removeUser, tryGetIndex, tryGetIndex, users
 

Method Detail

size

int size()
Specified by:
size in interface IDataSet
Returns:
the number of interaction events in the dataset.

maxRating

double maxRating()
Get the maximum rating in the dataset.


minRating

double minRating()
Get the minimum rating in the dataset.


countByUser

IntList countByUser()
Get the rating count by user.


countByItem

IntList countByItem()
Get the rating count by item.


average

double average()
Average rating in the dataset.


values

DoubleList values()

get

double get(int userId,
           int itemId)
Directly access rating by user and item

Parameters:
userId - the user ID
itemId - the item ID
Returns:
the rating value for the given user and item

get

double get(int index)
Directly access ratings.

Parameters:
index - the index of the rating
Returns:
the rating value

set

double set(int index,
           double rating)
Directly access the ratings

Parameters:
index - the rating index
rating - the rating value

tryGet

java.lang.Double tryGet(int user_id,
                        int item_id)
Try to retrieve a rating for a given user-item combination.

Parameters:
user_id - the user ID
item_id - the item ID
Returns:
the first rating encountered that matches the user ID and item ID, or null if none is found

tryGet

java.lang.Double tryGet(int user_id,
                        int item_id,
                        IntCollection indexes)
Try to retrieve a rating for a given user-item combination.

Parameters:
user_id - the user ID
item_id - the item ID
indexes - the indexes to look at
Returns:
the first rating encountered that matches the user ID and item ID, or null if none found

get

double get(int user_id,
           int item_id,
           IntCollection indexes)
Directly access rating by user and item.

Parameters:
user_id - the user ID
item_id - the item ID
indexes - the indexes to look at
Returns:
the first rating encountered that matches the user ID and item ID

add

void add(int user_id,
         int item_id,
         byte rating)
Add byte-valued rating to the collection.

Parameters:
user_id - the user ID
item_id - the item ID
rating - the rating

add

void add(int user_id,
         int item_id,
         float rating)
Add float-valued rating to the collection.

Parameters:
user_id - the user ID
item_id - the item ID
rating - the rating

add

void add(int user_id,
         int item_id,
         double rating)
Add a new rating.

Parameters:
user_id - the user ID
item_id - the item ID
rating - the rating value

removeAt

void removeAt(int index)
Remove the rating at the specified index

Parameters:
index - the rating index