public class RandomSplitDataSet extends Object implements DataSet
<userId><separator><itemId><separator><rating>
Where <separator> is an special character that delimits ratings fields (semicolon by default).
Training and test ratings are selected randomly by the probability of an user and an item to belong to the test set.
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 |
---|
RandomSplitDataSet(String filename)
Generates a DataSet form a text file.
|
RandomSplitDataSet(String filename,
double testUsersPercent,
double testItemsPercent)
Generates a DataSet form a text file.
|
RandomSplitDataSet(String filename,
double testUsersPercent,
double testItemsPercent,
long seed)
Generates a DataSet form a text file.
|
RandomSplitDataSet(String filename,
double testUsersPercent,
double testItemsPercent,
String separator)
Generates a DataSet form a text file.
|
RandomSplitDataSet(String filename,
double testUsersPercent,
double testItemsPercent,
String separator,
long seed)
Generates a DataSet form a text file.
|
RandomSplitDataSet(String filename,
String separator)
Generates a DataSet form a text file.
|
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 RandomSplitDataSet(String filename) throws IOException
filename
- File with the ratings.IOException
- When the file is not accessible by the system with read permissions.public RandomSplitDataSet(String filename, double testUsersPercent, double testItemsPercent) throws IOException
filename
- File with the ratings.testUsersPercent
- Percentage of users that will be of test.testItemsPercent
- Percentage of items that will be of test.IOException
- When the file is not accessible by the system with read permissions.public RandomSplitDataSet(String filename, double testUsersPercent, double testItemsPercent, long seed) throws IOException
filename
- File with the ratings.testUsersPercent
- Percentage of users that will be of test.testItemsPercent
- Percentage of items that will be of test.seed
- Seed applied to the random number generator.IOException
- When the file is not accessible by the system with read permissions.public RandomSplitDataSet(String filename, double testUsersPercent, double testItemsPercent, String separator) throws IOException
filename
- File with the ratings.testUsersPercent
- Percentage of users that will be of test.testItemsPercent
- Percentage of items that will be of test.separator
- Separator char between file fields.IOException
- When the file is not accessible by the system with read permissions.public RandomSplitDataSet(String filename, String separator) throws IOException
filename
- File with the ratings.separator
- Separator char between file fields.IOException
- When the file is not accessible by the system with read permissions.public RandomSplitDataSet(String filename, double testUsersPercent, double testItemsPercent, String separator, long seed) throws IOException
filename
- File with the ratings.testUsersPercent
- Percentage of users that will be of test.testItemsPercent
- Percentage of items that will be of test.seed
- Seed applied to the random number generator.separator
- Separator char between file 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.