Package es.upm.etsisi.cf4j.data
Class ManualDataSet
- java.lang.Object
-
- es.upm.etsisi.cf4j.data.ManualDataSet
-
-
Field Summary
Fields Modifier and Type Field Description protected List<DataSetEntry>
ratings
Raw stored ratingsprotected List<DataSetEntry>
testRatings
Raw stored test ratings
-
Constructor Summary
Constructors Constructor Description ManualDataSet(List<DataSetEntry> entries, double trainPercentage, Long seed)
Method separates the given data set entries into train and test rating depending on the trainPercentage.ManualDataSet(List<DataSetEntry> trainEntries, List<DataSetEntry> testEntries)
Method to specify the train and test entries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getNumberOfRatings()
This method indicates the number of (training) ratings.int
getNumberOfTestRatings()
This method indicates the number of test ratings.Iterator<DataSetEntry>
getRatingsIterator()
This method generates an iterator to navigate through the raw ratings stored in DataSetEntries.Iterator<DataSetEntry>
getTestRatingsIterator()
This method generates an iterator to navigate through the raw test ratings stored in DataSetEntries.
-
-
-
Field Detail
-
ratings
protected List<DataSetEntry> ratings
Raw stored ratings
-
testRatings
protected List<DataSetEntry> testRatings
Raw stored test ratings
-
-
Constructor Detail
-
ManualDataSet
public ManualDataSet(List<DataSetEntry> entries, double trainPercentage, @Nullable Long seed)
Method separates the given data set entries into train and test rating depending on the trainPercentage. This class is used when the manual import of data is required instead of using csv or similar formats. Randomized element is introduces by shuffling the given entries.- Parameters:
entries
- arraylist of datasetentriestrainPercentage
- set custom train data percentageseed
- random seed for random numbers generation
-
ManualDataSet
public ManualDataSet(List<DataSetEntry> trainEntries, List<DataSetEntry> testEntries)
Method to specify the train and test entries. This class is used when the manual import of data is required instead of using csv or similar formats.- Parameters:
trainEntries
- List of DataSetEntry with the train ratingstestEntries
- List of DataSetEntry with the test ratings
-
-
Method Detail
-
getRatingsIterator
public Iterator<DataSetEntry> getRatingsIterator()
Description copied from interface:DataSet
This method generates an iterator to navigate through the raw ratings stored in DataSetEntries.- Specified by:
getRatingsIterator
in interfaceDataSet
- Returns:
- Iterator of ratings
-
getTestRatingsIterator
public Iterator<DataSetEntry> getTestRatingsIterator()
Description copied from interface:DataSet
This method generates an iterator to navigate through the raw test ratings stored in DataSetEntries.- Specified by:
getTestRatingsIterator
in interfaceDataSet
- Returns:
- Iterator of test ratings
-
getNumberOfRatings
public int getNumberOfRatings()
Description copied from interface:DataSet
This method indicates the number of (training) ratings.- Specified by:
getNumberOfRatings
in interfaceDataSet
- Returns:
- Number of (training) ratings
-
getNumberOfTestRatings
public int getNumberOfTestRatings()
Description copied from interface:DataSet
This method indicates the number of test ratings.- Specified by:
getNumberOfTestRatings
in interfaceDataSet
- Returns:
- Number of test ratings
-
-