org.mymedialite.data
Class RatingsPerUserChronologicalSplit

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

public class RatingsPerUserChronologicalSplit
extends java.lang.Object
implements ISplit<ITimedRatings>

Per-user chronological split for rating prediction. Chronological splits (splits according to the time of the rating) treat all ratings before a certain time as training ratings, and the ones after that time as test/validation ratings. Here, the split date may differ from user to user. In the constructor, you can either specify which part (ratio) or how many of a user's rating are supposed to be used for validation. The dataset must not be modified after the split - this would lead to undefined behavior.


Field Summary
 java.util.List<ITimedRatings> test
           
 java.util.List<ITimedRatings> train
           
 
Constructor Summary
RatingsPerUserChronologicalSplit(ITimedRatings ratings, double ratio)
          Create a chronological split of rating prediction data.
RatingsPerUserChronologicalSplit(ITimedRatings ratings, int num_test_ratings_per_user)
          Create a chronological split of rating prediction data.
 
Method Summary
 int numberOfFolds()
          The number of folds in this split.
 java.util.List<ITimedRatings> test()
          Test data for the different folds.
 java.util.List<ITimedRatings> 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
 

Field Detail

train

public java.util.List<ITimedRatings> train

test

public java.util.List<ITimedRatings> test
Constructor Detail

RatingsPerUserChronologicalSplit

public RatingsPerUserChronologicalSplit(ITimedRatings ratings,
                                        double ratio)
Create a chronological split of rating prediction data. If ratings have exactly the same date and time, and they are close to the threshold between train and test, there is no guaranteed order between them (ties are broken according to how the sorting procedure sorts the ratings).

Parameters:
ratings - the dataset
ratio - the ratio of ratings to use for validation (per user)

RatingsPerUserChronologicalSplit

public RatingsPerUserChronologicalSplit(ITimedRatings ratings,
                                        int num_test_ratings_per_user)
Create a chronological split of rating prediction data. If ratings have exactly the same date and time, and they are close to the threshold between train and test, there is no guaranteed order between them (ties are broken according to how the sorting procedure sorts the ratings).

Parameters:
ratings - the dataset
num_test_ratings_per_user - the number of test ratings (per user)
Method Detail

numberOfFolds

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

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

train

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

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

test

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

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