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.data.splitter
Class KfoldCrossValidation

    java.lang.Object
      prea.data.splitter.DataSplitManager
          prea.data.splitter.KfoldCrossValidation

    public class KfoldCrossValidation

extends DataSplitManager

This class implements K-fold cross-validation.

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

Field Summary
`private SparseMatrix` | `assign`
`private int` | `foldCount`

Fields inherited from class prea.data.splitter.DataSplitManager
`itemCount, itemRateAverage, K_FOLD_CROSS_VALIDATION, maxValue, minValue, PREDEFINED_SPLIT, rateMatrix, SIMPLE_SPLIT, testMatrix, userCount, userRateAverage`

Constructor Summary
`KfoldCrossValidation(SparseMatrix originalMatrix, int k, int max, int min)` Construct an instance for K-fold cross-validation.

Method Summary
`private void` | `divideFolds(int k)` Divide the original rating matrix into k-fold.
`SparseMatrix` | `getKthFold(int k)` Return the k-th fold as test set (testMatrix), making all the others as train set in rateMatrix.

Methods inherited from class prea.data.splitter.DataSplitManager
`calculateAverage, getItemRateAverage, getTestMatrix, getUserRateAverage, recoverTestItems`

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

Field Detail

### assign

    private SparseMatrix assign

### foldCount

    private int foldCount

Constructor Detail

### KfoldCrossValidation

    public KfoldCrossValidation(SparseMatrix originalMatrix,
                                int k,
                                int max,
                                int min)

  Construct an instance for K-fold cross-validation.

Method Detail

### divideFolds

    private void divideFolds(int k)

  Divide the original rating matrix into k-fold. Illegal k would be adjusted automatically.

  Parameters:
    `k` - The index for desired fold.

### getKthFold

    public SparseMatrix getKthFold(int k)

  Return the k-th fold as test set (testMatrix), making all the others as train set in rateMatrix.

  Parameters:
    `k` - The index for desired fold.
  Returns:
    Rating matrix with test data with data points in k-th fold.

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