|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectConstantModel
public class ConstantModel
This is a class implementing three baselines, including constant model, user average, and item average.
Field Summary | |
---|---|
static int |
ITEM_AVG
Algorithm Code for Item Average |
int |
itemCount
The number of items. |
SparseVector |
itemRateAverage
Average of ratings for each item. |
int |
maxValue
Maximum value of rating, existing in the dataset. |
static int |
MEDIAN
Algorithm Code for Constant Model |
int |
minValue
Minimum value of rating, existing in the dataset. |
static int |
RANDOM
Algorithm Code for Random |
int |
rateCount
The total number of ratings in the rating matrix. |
SparseMatrix |
rateMatrix
Rating matrix for each user (row) and item (column) |
SparseMatrix |
testMatrix
Rating matrix for test items. |
static int |
USER_AVG
Algorithm Code for User Average |
int |
userCount
The number of users. |
SparseVector |
userRateAverage
Average of ratings for each user. |
Constructor Summary | |
---|---|
ConstantModel(SparseMatrix rm,
SparseMatrix tm,
SparseVector ura,
SparseVector ira,
int uc,
int ic,
int max,
int min)
Construct a constant model with the given data. |
Method Summary | |
---|---|
EvaluationMetrics |
evaluate(int method)
Evaluate the designated algorithm with the given test data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MEDIAN
public static final int USER_AVG
public static final int ITEM_AVG
public static final int RANDOM
public SparseMatrix rateMatrix
public SparseMatrix testMatrix
public SparseVector userRateAverage
public SparseVector itemRateAverage
public int userCount
public int itemCount
public int rateCount
public int maxValue
public int minValue
Constructor Detail |
---|
public ConstantModel(SparseMatrix rm, SparseMatrix tm, SparseVector ura, SparseVector ira, int uc, int ic, int max, int min)
rm
- The rating matrix which will be used for training.tm
- The rating matrix which will be used for testing.ura
- The average of ratings for each user.ira
- The average of ratings for each item.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.Method Detail |
---|
public EvaluationMetrics evaluate(int method)
method
- The code of algorithm to be tested. It can have one of the following:
MEDIAN, USER_AVG, or ITEM_AVG.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |