|
||||||||||
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.ItemBased
public class ItemBased
The class implementing item-based neighborhood method, predicting by referring to rating matrix for each query.
Field Summary | |
---|---|
SparseVector |
itemRateAverage
Average of ratings for each item. |
java.lang.String |
itemSimilarityFileName
The name of pre-calculated item similarity file, if it is used. |
boolean |
itemSimilarityPrefetch
Indicating whether the pre-calculated item 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 | |
---|---|
ItemBased(int uc,
int ic,
int max,
int min,
int ns,
int sim,
boolean df,
double dv,
SparseVector ira,
boolean isp,
java.lang.String isfn)
Construct an item-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,
SparseMatrix itemSim)
Predict ratings for a given user regarding given set of items, by user-based CF algorithm. |
private SparseMatrix |
readItemSimData(int[] validationItemSet)
Read the pre-calculated item similarity data file. |
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 itemRateAverage
public boolean itemSimilarityPrefetch
public java.lang.String itemSimilarityFileName
Constructor Detail |
---|
public ItemBased(int uc, int ic, int max, int min, int ns, int sim, boolean df, double dv, SparseVector ira, boolean isp, java.lang.String isfn)
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.ira
- The average of ratings for each item.isp
- Whether the pre-calculated item similarity file is used.isfn
- The name of pre-calculated item 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, SparseMatrix itemSim)
userNo
- The user ID.testItemIndex
- The list of items whose ratings will be predicted.k
- The neighborhood size.itemSim
- 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 should be either WEIGHTED_SUM or SIMPLE_WEIGHTED_AVG.
private SparseMatrix readItemSimData(int[] validationItemSet)
validationItemSet
- The list of items which will be used for validation.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |