|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.cf.taste.impl.common.jdbc.AbstractJDBCComponent
org.apache.mahout.cf.taste.impl.recommender.slopeone.jdbc.AbstractJDBCDiffStorage
public abstract class AbstractJDBCDiffStorage
A DiffStorage
which stores diffs in a database. Database-specific implementations subclass this
abstract class. Note that this implementation has a fairly particular dependence on the
DataModel
used; it needs a JDBCDataModel
attached to the
same database since its efficient operation depends on accessing preference data in the database directly.
Field Summary | |
---|---|
static String |
DEFAULT_AVERAGE_DIFF_COLUMN
|
static String |
DEFAULT_COUNT_COLUMN
|
static String |
DEFAULT_DIFF_TABLE
|
static String |
DEFAULT_ITEM_A_COLUMN
|
static String |
DEFAULT_ITEM_B_COLUMN
|
static String |
DEFAULT_STDEV_COLUMN
|
Fields inherited from class org.apache.mahout.cf.taste.impl.common.jdbc.AbstractJDBCComponent |
---|
DEFAULT_DATASOURCE_NAME |
Constructor Summary | |
---|---|
protected |
AbstractJDBCDiffStorage(JDBCDataModel dataModel,
String getDiffSQL,
String getDiffsSQL,
String getAverageItemPrefSQL,
String getDiffsAffectedByUserSQL,
String[] updateDiffSQLs,
String updateOneDiffSQL,
String addDiffSQL,
String removeDiffSQL,
String getRecommendableItemsSQL,
String deleteDiffsSQL,
String createDiffsSQL,
String diffsExistSQL,
int minDiffCount)
|
Method Summary | |
---|---|
void |
addItemPref(long userID,
long itemID,
float prefValue)
Updates internal data structures to reflect a new preference value for an item. |
RunningAverage |
getAverageItemPref(long itemID)
|
RunningAverage |
getDiff(long itemID1,
long itemID2)
|
RunningAverage[] |
getDiffs(long userID,
long itemID,
PreferenceArray prefs)
|
FastIDSet |
getRecommendableItemIDs(long userID)
|
void |
refresh(Collection<Refreshable> alreadyRefreshed)
Triggers "refresh" -- whatever that means -- of the implementation. |
void |
removeItemPref(long userID,
long itemID,
float prefValue)
Updates internal data structures to reflect an update in a preference value for an item. |
void |
updateItemPref(long itemID,
float prefDelta)
Note that this implementation does not update standard deviations. |
Methods inherited from class org.apache.mahout.cf.taste.impl.common.jdbc.AbstractJDBCComponent |
---|
checkNotNullAndLog, checkNotNullAndLog, getFetchSize, lookupDataSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_DIFF_TABLE
public static final String DEFAULT_ITEM_A_COLUMN
public static final String DEFAULT_ITEM_B_COLUMN
public static final String DEFAULT_COUNT_COLUMN
public static final String DEFAULT_AVERAGE_DIFF_COLUMN
public static final String DEFAULT_STDEV_COLUMN
Constructor Detail |
---|
protected AbstractJDBCDiffStorage(JDBCDataModel dataModel, String getDiffSQL, String getDiffsSQL, String getAverageItemPrefSQL, String getDiffsAffectedByUserSQL, String[] updateDiffSQLs, String updateOneDiffSQL, String addDiffSQL, String removeDiffSQL, String getRecommendableItemsSQL, String deleteDiffsSQL, String createDiffsSQL, String diffsExistSQL, int minDiffCount) throws TasteException
TasteException
Method Detail |
---|
public RunningAverage getDiff(long itemID1, long itemID2) throws TasteException
getDiff
in interface DiffStorage
RunningAverage
encapsulating the average difference in preferences between items
corresponding to itemID1
and itemID2
, in that direction; that is, it's
the average of item 2's preferences minus item 1's preferences
TasteException
public RunningAverage[] getDiffs(long userID, long itemID, PreferenceArray prefs) throws TasteException
getDiffs
in interface DiffStorage
userID
- user ID to get diffs foritemID
- itemID to assessprefs
- user's preferendces
RunningAverage
s for that user's item-item diffs
TasteException
public RunningAverage getAverageItemPref(long itemID) throws TasteException
getAverageItemPref
in interface DiffStorage
RunningAverage
encapsulating the average preference for the given item
TasteException
public void addItemPref(long userID, long itemID, float prefValue) throws TasteException
DiffStorage
Updates internal data structures to reflect a new preference value for an item.
addItemPref
in interface DiffStorage
userID
- user whose pref is being addeditemID
- item to add preference value forprefValue
- new preference value
TasteException
public void updateItemPref(long itemID, float prefDelta) throws TasteException
updateItemPref
in interface DiffStorage
itemID
- item to update preference value forprefDelta
- amount by which preference value changed
TasteException
public void removeItemPref(long userID, long itemID, float prefValue) throws TasteException
DiffStorage
Updates internal data structures to reflect an update in a preference value for an item.
removeItemPref
in interface DiffStorage
userID
- user whose pref is being removeditemID
- item to update preference value forprefValue
- old preference value
TasteException
public FastIDSet getRecommendableItemIDs(long userID) throws TasteException
getRecommendableItemIDs
in interface DiffStorage
TasteException
public void refresh(Collection<Refreshable> alreadyRefreshed)
Refreshable
Triggers "refresh" -- whatever that means -- of the implementation. The general contract is that any should always leave itself in a consistent, operational state, and that the refresh atomically updates internal state from old to new.
refresh
in interface Refreshable
alreadyRefreshed
- s that are known to have already been
refreshed as a result of an initial call to a method on some
object. This ensure that objects in a refresh dependency graph aren't refreshed twice
needlessly.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |