|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectprea.recommender.memory.MemoryBasedRecommender
prea.recommender.memory.UserBased
public class UserBased
The class implementing user-based neighborhood method, predicting by referring to rating matrix for each query.
| Field Summary | |
|---|---|
SparseVector |
userRateAverage
Average of ratings for each user. |
java.lang.String |
userSimilarityFileName
The name of pre-calculated user similarity file, if it is used. |
boolean |
userSimilarityPrefetch
Indicating whether the pre-calculated user similarity file is used. |
| Fields inherited from class prea.recommender.memory.MemoryBasedRecommender |
|---|
defaultValue, defaultVote, INVERSE_USER_FREQUENCY, itemCount, maxValue, MEAN_ABS_DIFF, MEAN_SQUARE_DIFF, minValue, neighborSize, PEARSON_CORR, rateMatrix, similarityMethod, SIMPLE_WEIGHTED_AVG, userCount, VECTOR_COS, WEIGHTED_SUM |
| Constructor Summary | |
|---|---|
UserBased(int uc,
int ic,
int max,
int min,
int ns,
int sim,
boolean df,
double dv,
SparseVector ura,
boolean usp,
java.lang.String usfn)
Construct a user-based model with the given data. |
|
| Method Summary | |
|---|---|
private double |
estimation(int activeIndex,
int targetIndex,
int[] ref,
int refCount,
double[] refWeight,
int method)
Estimate a rating based on neighborhood data. |
EvaluationMetrics |
evaluate(SparseMatrix testMatrix)
Evaluate the designated algorithm with the given test data. |
private SparseVector |
predict(int userNo,
int[] testItemIndex,
int k,
double[] userSim)
Predict ratings for a given user regarding given set of items, by user-based CF algorithm. |
| Methods inherited from class prea.recommender.memory.MemoryBasedRecommender |
|---|
buildModel, similarity |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public SparseVector userRateAverage
public boolean userSimilarityPrefetch
public java.lang.String userSimilarityFileName
| Constructor Detail |
|---|
public UserBased(int uc,
int ic,
int max,
int min,
int ns,
int sim,
boolean df,
double dv,
SparseVector ura,
boolean usp,
java.lang.String usfn)
uc - The number of users in the dataset.ic - The number of items in the dataset.max - The maximum rating value in the dataset.min - The minimum rating value in the dataset.ns - The neighborhood size.sim - The method code of similarity measure.df - Indicator whether to use default values.dv - Default value if used.ura - The average of ratings for each user.usp - Whether the pre-calculated user similarity file is used.usfn - The name of pre-calculated user similarity file, if it is used.| Method Detail |
|---|
public EvaluationMetrics evaluate(SparseMatrix testMatrix)
testMatrix - A rating matrix with test data.
private SparseVector predict(int userNo,
int[] testItemIndex,
int k,
double[] userSim)
userNo - The user ID.testItemIndex - The list of items whose ratings will be predicted.k - The neighborhood size.userSim - The similarity vector between the target user and all the other users.
private double estimation(int activeIndex,
int targetIndex,
int[] ref,
int refCount,
double[] refWeight,
int method)
activeIndex - The active user index for user-based CF; The item index for item-based CF.targetIndex - The target item index for user-based CF; The user index for item-based CF.ref - The indices of neighborhood, which will be used for estimation.refCount - The number of neighborhood, which will be used for estimation.refWeight - The weight of each neighborhood.method - The code of estimation method. It can be one of the following: WEIGHTED_SUM or SIMPLE_WEIGHTED_AVG.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||