|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.cf.taste.impl.recommender.AbstractCandidateItemsStrategy
org.apache.mahout.cf.taste.impl.recommender.SamplingCandidateItemsStrategy
public class SamplingCandidateItemsStrategy
Returns all items that have not been rated by the user (3) and that were preferred by another user (2) that has preferred at least one item (1) that the current user has preferred too.
This strategy uses sampling to limit the number of items that are considered, by sampling three different things, noted above:
There is a maximum associated with each of these three things; if the number of items or users exceeds that max, it is sampled so that the expected number of items or users actually used in that part of the computation is equal to the max.
Three arguments control these three maxima. Each is a "factor" f, which establishes the max at f * log2(n), where n is the number of users or items in the data. For example if factor #2 is 5, which controls the number of users sampled per item, then 5 * log2(# users) is the maximum for this part of the computation.
Each can be set to not do any limiting with value NO_LIMIT_FACTOR
.
Field Summary | |
---|---|
static int |
DEFAULT_FACTOR
Default factor used if not otherwise specified, for all limits. |
static int |
NO_LIMIT_FACTOR
Specify this value as a factor to mean no limit. |
Constructor Summary | |
---|---|
SamplingCandidateItemsStrategy(int numUsers,
int numItems)
Defaults to using no limit ( NO_LIMIT_FACTOR ) for all factors, except
candidatesPerUserFactor which defaults to DEFAULT_FACTOR . |
|
SamplingCandidateItemsStrategy(int itemsFactor,
int usersPerItemFactor,
int candidatesPerUserFactor,
int numUsers,
int numItems)
|
Method Summary | |
---|---|
protected FastIDSet |
doGetCandidateItems(long[] preferredItemIDs,
DataModel dataModel)
|
Methods inherited from class org.apache.mahout.cf.taste.impl.recommender.AbstractCandidateItemsStrategy |
---|
getCandidateItems, getCandidateItems, refresh |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_FACTOR
public static final int NO_LIMIT_FACTOR
Constructor Detail |
---|
public SamplingCandidateItemsStrategy(int numUsers, int numItems)
NO_LIMIT_FACTOR
) for all factors, except
candidatesPerUserFactor
which defaults to DEFAULT_FACTOR
.
SamplingCandidateItemsStrategy(int, int, int, int, int)
public SamplingCandidateItemsStrategy(int itemsFactor, int usersPerItemFactor, int candidatesPerUserFactor, int numUsers, int numItems)
itemsFactor
- factor controlling max items considered for a userusersPerItemFactor
- factor controlling max users considered for each of those itemscandidatesPerUserFactor
- factor controlling max candidate items considered from each of those usersnumUsers
- number of users currently in the datanumItems
- number of items in the dataMethod Detail |
---|
protected FastIDSet doGetCandidateItems(long[] preferredItemIDs, DataModel dataModel) throws TasteException
doGetCandidateItems
in class AbstractCandidateItemsStrategy
TasteException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |