public interface DataModel extends Refreshable, Serializable
Implementations represent a repository of information about users and their associated Preference
s
for items.
Modifier and Type | Method and Description |
---|---|
LongPrimitiveIterator |
getItemIDs() |
FastIDSet |
getItemIDsFromUser(long userID) |
float |
getMaxPreference() |
float |
getMinPreference() |
int |
getNumItems() |
int |
getNumUsers() |
int |
getNumUsersWithPreferenceFor(long itemID) |
int |
getNumUsersWithPreferenceFor(long itemID1,
long itemID2) |
PreferenceArray |
getPreferencesForItem(long itemID) |
PreferenceArray |
getPreferencesFromUser(long userID) |
Long |
getPreferenceTime(long userID,
long itemID)
Retrieves the time at which a preference value from a user and item was set, if known.
|
Float |
getPreferenceValue(long userID,
long itemID)
Retrieves the preference value for a single user and item.
|
LongPrimitiveIterator |
getUserIDs() |
boolean |
hasPreferenceValues() |
void |
removePreference(long userID,
long itemID)
Removes a particular preference for a user.
|
void |
setPreference(long userID,
long itemID,
float value)
Sets a particular preference (item plus rating) for a user.
|
refresh
LongPrimitiveIterator getUserIDs() throws TasteException
TasteException
- if an error occurs while accessing the dataPreferenceArray getPreferencesFromUser(long userID) throws TasteException
userID
- ID of user to get prefs forNoSuchUserException
- if the user does not existTasteException
- if an error occurs while accessing the dataFastIDSet getItemIDsFromUser(long userID) throws TasteException
userID
- ID of user to get prefs forNoSuchUserException
- if the user does not existTasteException
- if an error occurs while accessing the dataLongPrimitiveIterator getItemIDs() throws TasteException
LongPrimitiveIterator
of all item IDs in the model, in orderTasteException
- if an error occurs while accessing the dataPreferenceArray getPreferencesForItem(long itemID) throws TasteException
itemID
- item IDPreference
s expressed for that item, ordered by user ID, as an arrayNoSuchItemException
- if the item does not existTasteException
- if an error occurs while accessing the dataFloat getPreferenceValue(long userID, long itemID) throws TasteException
userID
- user ID to get pref value fromitemID
- item ID to get pref value forNoSuchUserException
- if the user does not existTasteException
- if an error occurs while accessing the dataLong getPreferenceTime(long userID, long itemID) throws TasteException
userID
- user ID for preference in questionitemID
- item ID for preference in questionNoSuchUserException
- if the user does not existTasteException
- if an error occurs while accessing the dataint getNumItems() throws TasteException
TasteException
- if an error occurs while accessing the dataint getNumUsers() throws TasteException
TasteException
- if an error occurs while accessing the dataint getNumUsersWithPreferenceFor(long itemID) throws TasteException
itemID
- item ID to check forTasteException
- if an error occurs while accessing the dataint getNumUsersWithPreferenceFor(long itemID1, long itemID2) throws TasteException
itemID1
- first item ID to check foritemID2
- second item ID to check forTasteException
- if an error occurs while accessing the datavoid setPreference(long userID, long itemID, float value) throws TasteException
Sets a particular preference (item plus rating) for a user.
userID
- user to set preference foritemID
- item to set preference forvalue
- preference valueNoSuchItemException
- if the item does not existNoSuchUserException
- if the user does not existTasteException
- if an error occurs while accessing the datavoid removePreference(long userID, long itemID) throws TasteException
Removes a particular preference for a user.
userID
- user from which to remove preferenceitemID
- item to remove preference forNoSuchItemException
- if the item does not existNoSuchUserException
- if the user does not existTasteException
- if an error occurs while accessing the databoolean hasPreferenceValues()
float getMaxPreference()
Recommender
may estimate a preference value above 5.0, it
isn't "fair" to consider that the system is actually suggesting an impossible rating of, say, 5.4 stars.
In practice the application would cap this estimate to 5.0. Since evaluators evaluate
the difference between estimated and actual value, this at least prevents this effect from unfairly
penalizing a Recommender
float getMinPreference()
getMaxPreference()
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.