org.mymedialite.data
Class RatingCrossValidationSplit

java.lang.Object
  extended by org.mymedialite.data.RatingCrossValidationSplit
All Implemented Interfaces:
ISplit<IRatings>

public class RatingCrossValidationSplit
extends java.lang.Object
implements ISplit<IRatings>

k-fold cross-validation split for rating prediction. Please note that k-fold cross-validation is not the best/most realistic way of evaluating recommender system algorithms. In particular, chronological splits (see RatingsChronologicalSplit) are more realistic. The dataset must not be modified after the split - this would lead to undefined behavior.


Constructor Summary
RatingCrossValidationSplit(IRatings ratings, int num_folds)
          Create a k-fold split of rating prediction data.
 
Method Summary
 int numberOfFolds()
          The number of folds in this split.
 java.util.List<IRatings> test()
          Test data for the different folds.
 java.util.List<IRatings> train()
          Training data for the different folds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RatingCrossValidationSplit

public RatingCrossValidationSplit(IRatings ratings,
                                  int num_folds)
Create a k-fold split of rating prediction data.

Parameters:
ratings - the dataset
num_folds - the number of folds
Method Detail

numberOfFolds

public int numberOfFolds()
Description copied from interface: ISplit
The number of folds in this split.

Specified by:
numberOfFolds in interface ISplit<IRatings>
Returns:
The number of folds in this split

train

public java.util.List<IRatings> train()
Description copied from interface: ISplit
Training data for the different folds.

Specified by:
train in interface ISplit<IRatings>
Returns:
A list of T

test

public java.util.List<IRatings> test()
Description copied from interface: ISplit
Test data for the different folds.

Specified by:
test in interface ISplit<IRatings>
Returns:
A list of T