Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## prea.recommender.baseline
Class BaselineRecommender

    java.lang.Object
      prea.recommender.baseline.BaselineRecommender

All Implemented Interfaces:
  Recommender

Direct Known Subclasses:
  Average, Constant, ItemAverage, Random, UserAverage

    public abstract class BaselineRecommender

extends java.lang.Object
implements Recommender

This is an abstract class implementing five baselines, including constant model, overall average, user average, item average, and random.

Since:
  2012. 4. 20
Version:
  1.1
Author:
  Joonseok Lee

Field Summary
`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.
`protected SparseMatrix` | `rateMatrix` Rating matrix for each user (row) and item (column)
`int` | `userCount` The number of users.

Constructor Summary
`BaselineRecommender(int uc, int ic, double max, double min)` Construct a constant model with the given data.

Method Summary
`void` | `buildModel(SparseMatrix rm)` Build a model with given training set.
`EvaluationMetrics` | `evaluate(SparseMatrix testMatrix)` Evaluate the designated algorithm with the given test data.
`(package private) abstract double` | `predict(int userId, int itemId)` Predict a rating for the given user and item.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### rateMatrix

    protected SparseMatrix rateMatrix

  Rating matrix for each user (row) and item (column)

### userCount

    public int userCount

  The number of users.

### itemCount

    public int itemCount

  The number of items.

### maxValue

    public double maxValue

  Maximum value of rating, existing in the dataset.

### minValue

    public double minValue

  Minimum value of rating, existing in the dataset.

Constructor Detail

### BaselineRecommender

    public BaselineRecommender(int uc,
                               int ic,
                               double max,
                               double min)

  Construct a constant model with the given data.

  Parameters:
    `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

### buildModel

    public void buildModel(SparseMatrix rm)

  Build a model with given training set.

  Specified by:
    `buildModel` in interface `Recommender`
  Parameters:
    `rm` - Training data set.

### predict

    abstract double predict(int userId,
                            int itemId)

  Predict a rating for the given user and item.

  Parameters:
    `userId` - The target user.
    `itemId` - The target item.
  Returns:
    predicted rating.

### evaluate

    public EvaluationMetrics evaluate(SparseMatrix testMatrix)

  Evaluate the designated algorithm with the given test data.

  Specified by:
    `evaluate` in interface `Recommender`
  Parameters:
    `testMatrix` - The matrix with test data points used for evaluation.
  Returns:
    The result of evaluation, such as MAE, RMSE, and rank-score.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD