|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectprea.recommender.etc.SlopeOne
public class SlopeOne
This is a class implementing Slope-One algorithm. Technical detail of the algorithm can be found in Daniel Lemire and Anna Maclachlan, Slope One Predictors for Online Rating-Based Collaborative Filtering, Society for Industrial Mathematics, 05:471-480, 2005.
Field Summary | |
---|---|
private DenseMatrix |
diffMatrix
Prepared difference matrix |
private DenseMatrix |
freqMatrix
Prepared frequency matrix |
int |
itemCount
The number of items. |
double |
maxValue
Maximum value of rating, existing in the dataset. |
double |
minValue
Minimum value of rating, existing in the dataset. |
SparseMatrix |
rateMatrix
Rating matrix for each user (row) and item (column) |
int |
userCount
The number of users. |
Constructor Summary | |
---|---|
SlopeOne(int uc,
int ic,
double max,
double min)
Construct a Fast NPCA model with the given data. |
Method Summary | |
---|---|
void |
buildModel(SparseMatrix rm)
Build a model with the given data and algorithm. |
EvaluationMetrics |
evaluate(SparseMatrix testMatrix)
Evaluate the designated algorithm with the given test data. |
private SparseVector |
getEstimation(int u,
int[] testItems)
Estimate of ratings for a given user and a set of test items. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public SparseMatrix rateMatrix
public int userCount
public int itemCount
public double maxValue
public double minValue
private DenseMatrix diffMatrix
private DenseMatrix freqMatrix
Constructor Detail |
---|
public SlopeOne(int uc, int ic, double max, double min)
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 void buildModel(SparseMatrix rm)
buildModel
in interface Recommender
rm
- The rating matrix with train data.public EvaluationMetrics evaluate(SparseMatrix testMatrix)
evaluate
in interface Recommender
testMatrix
- The rating matrix with test data.
private SparseVector getEstimation(int u, int[] testItems)
u
- The user number.testItems
- The list of items to be predicted.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |