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.etc
Class FastNPCA

    java.lang.Object
      prea.recommender.etc.FastNPCA

All Implemented Interfaces:
  Recommender

    public class FastNPCA

extends java.lang.Object
implements Recommender

This is a class implementing Fast Nonparametric Principal Component Analysis (NPCA). Technical detail of the algorithm can be found in Kai Yu et al, Fast Nonparametric Matrix Factorization for Large-scale Collaborative Filtering, Proceedings of the 32nd international ACM SIGIR conference on Research and development in information retrieval, 2009.

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

Field Summary
`int` | `itemCount` The number of items.
`private SparseMatrix` | `K`
`int` | `maxIter` Maximum number of iteration.
`double` | `maxValue` Maximum value of rating, existing in the dataset.
`double` | `minValue` Minimum value of rating, existing in the dataset.
`private SparseVector` | `mu`
`SparseMatrix` | `rateMatrix` Rating matrix for each user (row) and item (column)
`boolean` | `showProgress` Indicator whether to show progress of iteration.
`int` | `userCount` The number of users.
`private SparseMatrix` | `validationMatrix` Rating matrix for items which will be used during the validation phase.
`double` | `validationRatio` Proportion of dataset, using for validation purpose.

Constructor Summary
`FastNPCA(int uc, int ic, double max, double min, double vr, int iter)` 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.
`private void` | `makeValidationSet(double validationRatio)` Items which will be used for validation purpose are moved from rateMatrix to validationMatrix.
`private void` | `restoreValidationSet()` Items in validationMatrix are moved to original rateMatrix.

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

Field Detail

### rateMatrix

    public SparseMatrix rateMatrix

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

### validationMatrix

    private SparseMatrix validationMatrix

  Rating matrix for items which will be used during the validation phase. Not allowed to refer during training phase.

### 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.

### maxIter

    public int maxIter

  Maximum number of iteration.

### validationRatio

    public double validationRatio

  Proportion of dataset, using for validation purpose.

### showProgress

    public boolean showProgress

  Indicator whether to show progress of iteration.

### K

    private SparseMatrix K

### mu

    private SparseVector mu

Constructor Detail

### FastNPCA

    public FastNPCA(int uc,
                    int ic,
                    double max,
                    double min,
                    double vr,
                    int iter)

  Construct a Fast NPCA 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.
    `vr` - The proportion of dataset which will be used for validation.
    `iter` - The maximum number of iteration.

Method Detail

### buildModel

    public void buildModel(SparseMatrix rm)

  Build a model with the given data and algorithm.

  Specified by:
    `buildModel` in interface `Recommender`
  Parameters:
    `rm` - The rating matrix with train data.

### evaluate

    public EvaluationMetrics evaluate(SparseMatrix testMatrix)

  Evaluate the designated algorithm with the given test data.

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

### getEstimation

    private SparseVector getEstimation(int u,
                                       int[] testItems)

  Estimate of ratings for a given user and a set of test items.

  Parameters:
    `u` - The user number.
    `testItems` - The list of items to be predicted.
  Returns:
    A list containing predicted rating scores.

### makeValidationSet

    private void makeValidationSet(double validationRatio)

  Items which will be used for validation purpose are moved from rateMatrix to validationMatrix.

  Parameters:
    `validationRatio` - Proportion of dataset, using for validation purpose.

### restoreValidationSet

    private void restoreValidationSet()

  Items in validationMatrix are moved to original rateMatrix.

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