public class TrainTestFilesDataSet extends Object implements DataSet
<userId><separator><itemId><separator><rating>
Where <separator> is an special character that delimits ratings fields (semicolon by default).
Modifier and Type | Field and Description |
---|---|
protected static String |
DEFAULT_SEPARATOR |
protected ArrayList<DataSetEntry> |
ratings
Raw stored ratings
|
protected ArrayList<DataSetEntry> |
testRatings
Raw stored test ratings
|
Constructor and Description |
---|
TrainTestFilesDataSet(String trainingFileName,
String testFileName)
Generates a DataSet form training and test ratings files.
|
TrainTestFilesDataSet(String trainingFileName,
String testFileName,
String separator)
Generates a DataSet form training and test ratings files.
|
Modifier and Type | Method and 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.
|
protected static final String DEFAULT_SEPARATOR
protected ArrayList<DataSetEntry> ratings
protected ArrayList<DataSetEntry> testRatings
public TrainTestFilesDataSet(String trainingFileName, String testFileName) throws IOException
trainingFileName
- File with the (training) ratings.testFileName
- File with the test ratings.IOException
- When the file is not accessible by the system with read permissions.public TrainTestFilesDataSet(String trainingFileName, String testFileName, String separator) throws IOException
trainingFileName
- File with the (training) ratings.testFileName
- File with the test ratings.separator
- Separator char between ratings fields.IOException
- When the file is not accessible by the system with read permissions.public Iterator<DataSetEntry> getRatingsIterator()
DataSet
getRatingsIterator
in interface DataSet
public Iterator<DataSetEntry> getTestRatingsIterator()
DataSet
getTestRatingsIterator
in interface DataSet
public int getNumberOfRatings()
DataSet
getNumberOfRatings
in interface DataSet
public int getNumberOfTestRatings()
DataSet
getNumberOfTestRatings
in interface DataSet
Copyright © 2020. All rights reserved.