org.mymedialite.data
Class RatingsChronologicalSplit

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

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

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. This kind of split is the most realistic kind of split, because in a real application you also can only use past data to make predictions for the future. The dataset must not be modified after the split - this would lead to undefined behavior.


Constructor Summary
RatingsChronologicalSplit(ITimedRatings ratings, java.util.Date split_time)
          Create a chronological split of rating prediction data.
RatingsChronologicalSplit(ITimedRatings ratings, double ratio)
          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
 

Constructor Detail

RatingsChronologicalSplit

public RatingsChronologicalSplit(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

RatingsChronologicalSplit

public RatingsChronologicalSplit(ITimedRatings ratings,
                                 java.util.Date split_time)
Create a chronological split of rating prediction data.

Parameters:
ratings - the dataset
split_time - the point in time to use for splitting the data set; everything from that point on will be used for validation
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