|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectprea.recommender.memory.MemoryBasedRecommender
public abstract class MemoryBasedRecommender
The class implementing two memory-based (neighborhood-based) methods, predicting by referring to rating matrix for each query. Contains user-based and item-based, with some variations on them.
| Field Summary | |
|---|---|
double |
defaultValue
The default voting value, if used. |
boolean |
defaultVote
Indicating whether to use default vote value. |
static int |
INVERSE_USER_FREQUENCY
Similarity Measure Code for Inverse User Frequency |
int |
itemCount
The number of items. |
int |
maxValue
Maximum value of rating, existing in the dataset. |
static int |
MEAN_ABS_DIFF
Similarity Measure Code for Mean Absolute Difference (MAD) |
static int |
MEAN_SQUARE_DIFF
Similarity Measure Code for Mean Squared Difference (MSD) |
int |
minValue
Minimum value of rating, existing in the dataset. |
int |
neighborSize
The number of neighbors, used for estimation. |
static int |
PEARSON_CORR
Similarity Measure Code for Pearson Correlation |
SparseMatrix |
rateMatrix
Rating matrix for each user (row) and item (column) |
int |
similarityMethod
The method code for similarity measure. |
static int |
SIMPLE_WEIGHTED_AVG
Estimation Method Code for Simple Weighted Average |
int |
userCount
The number of users. |
static int |
VECTOR_COS
Similarity Measure Code for Vector Cosine |
static int |
WEIGHTED_SUM
Estimation Method Code for Weighted Sum |
| Constructor Summary | |
|---|---|
MemoryBasedRecommender(int uc,
int ic,
int max,
int min,
int ns,
int sim,
boolean df,
double dv)
Construct a memory-based model with the given data. |
|
| Method Summary | |
|---|---|
void |
buildModel(SparseMatrix rm)
Build a model with given training set. |
double |
similarity(boolean rowOriented,
SparseVector i1,
SparseVector i2,
double i1Avg,
double i2Avg,
int method)
Calculate similarity between two given vectors. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface prea.recommender.Recommender |
|---|
evaluate |
| Field Detail |
|---|
public static final int PEARSON_CORR
public static final int VECTOR_COS
public static final int MEAN_SQUARE_DIFF
public static final int MEAN_ABS_DIFF
public static final int INVERSE_USER_FREQUENCY
public static final int WEIGHTED_SUM
public static final int SIMPLE_WEIGHTED_AVG
public SparseMatrix rateMatrix
public int userCount
public int itemCount
public int maxValue
public int minValue
public int neighborSize
public int similarityMethod
public boolean defaultVote
public double defaultValue
| Constructor Detail |
|---|
public MemoryBasedRecommender(int uc,
int ic,
int max,
int min,
int ns,
int sim,
boolean df,
double dv)
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.| Method Detail |
|---|
public void buildModel(SparseMatrix rm)
buildModel in interface Recommenderrm - Training data set.
public double similarity(boolean rowOriented,
SparseVector i1,
SparseVector i2,
double i1Avg,
double i2Avg,
int method)
rowOriented - Use true if user-based, false if item-based.i1 - The first vector to calculate similarity.i2 - The second vector to calculate similarity.i1Avg - The average of elements in the first vector.i2Avg - The average of elements in the second vector.method - The code of similarity measure to be used.
It can be one of the following: PEARSON_CORR, VECTOR_COS,
MEAN_SQUARE_DIFF, MEAN_ABS_DIFF, or INVERSE_USER_FREQUENCY.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||