public final class KDDCupDataModel extends Object implements DataModel
An DataModel which reads into memory any of the KDD Cup's rating files; it is really
meant for use with training data in the files trainIdx{1,2}}.txt.
See http://kddcup.yahoo.com/.
Timestamps in the data set are relative to some unknown point in time, for anonymity. They are assumed to be relative to the epoch, time 0, or January 1 1970, for purposes here.
| Constructor and Description |
|---|
KDDCupDataModel(File dataFile) |
KDDCupDataModel(File dataFile,
boolean storeDates,
double samplingRate) |
| Modifier and Type | Method and Description |
|---|---|
File |
getDataFileDirectory() |
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) |
Float |
getPreferenceValue(long userID,
long itemID) |
static File |
getTestFile(File dataFileDirectory) |
static File |
getTrackFile(File dataFileDirectory) |
static File |
getTrainingFile(File dataFileDirectory) |
LongPrimitiveIterator |
getUserIDs() |
static File |
getValidationFile(File dataFileDirectory) |
boolean |
hasPreferenceValues() |
void |
refresh(Collection<Refreshable> alreadyRefreshed) |
void |
removePreference(long userID,
long itemID) |
void |
setPreference(long userID,
long itemID,
float value) |
public KDDCupDataModel(File dataFile) throws IOException
dataFile - training rating fileIOExceptionpublic KDDCupDataModel(File dataFile, boolean storeDates, double samplingRate) throws IOException
dataFile - training rating filestoreDates - if true, dates are parsed and stored, otherwise notsamplingRate - percentage of users to keep; can be used to reduce memory requirementsIOExceptionpublic File getDataFileDirectory()
public LongPrimitiveIterator getUserIDs() throws TasteException
getUserIDs in interface DataModelTasteExceptionpublic PreferenceArray getPreferencesFromUser(long userID) throws TasteException
getPreferencesFromUser in interface DataModelTasteExceptionpublic FastIDSet getItemIDsFromUser(long userID) throws TasteException
getItemIDsFromUser in interface DataModelTasteExceptionpublic LongPrimitiveIterator getItemIDs() throws TasteException
getItemIDs in interface DataModelTasteExceptionpublic PreferenceArray getPreferencesForItem(long itemID) throws TasteException
getPreferencesForItem in interface DataModelTasteExceptionpublic Float getPreferenceValue(long userID, long itemID) throws TasteException
getPreferenceValue in interface DataModelTasteExceptionpublic Long getPreferenceTime(long userID, long itemID) throws TasteException
getPreferenceTime in interface DataModelTasteExceptionpublic int getNumItems()
throws TasteException
getNumItems in interface DataModelTasteExceptionpublic int getNumUsers()
throws TasteException
getNumUsers in interface DataModelTasteExceptionpublic int getNumUsersWithPreferenceFor(long itemID)
throws TasteException
getNumUsersWithPreferenceFor in interface DataModelTasteExceptionpublic int getNumUsersWithPreferenceFor(long itemID1,
long itemID2)
throws TasteException
getNumUsersWithPreferenceFor in interface DataModelTasteExceptionpublic void setPreference(long userID,
long itemID,
float value)
throws TasteException
setPreference in interface DataModelTasteExceptionpublic void removePreference(long userID,
long itemID)
throws TasteException
removePreference in interface DataModelTasteExceptionpublic boolean hasPreferenceValues()
hasPreferenceValues in interface DataModelpublic float getMaxPreference()
getMaxPreference in interface DataModelpublic float getMinPreference()
getMinPreference in interface DataModelpublic void refresh(Collection<Refreshable> alreadyRefreshed)
refresh in interface RefreshableCopyright © 2008–2013 The Apache Software Foundation. All rights reserved.