public class RatioDataSplitter extends AbstractDataSplitter
DataSplitter.SplitterType
dataConvertor, LOG, testMatrix, trainMatrix, validationMatrix
conf, CONF_DATA_COLUMN_FORMAT, CONF_DATA_INPUT_PATH, CONF_DFS_DATA_DIR
Constructor and Description |
---|
RatioDataSplitter()
Empty constructor.
|
RatioDataSplitter(DataConvertor dataConvertor,
Configuration conf)
Initializes a newly created
RatioDataSplitter object
with convertor and configuration. |
Modifier and Type | Method and Description |
---|---|
void |
getFixedRatioByUser(double ratio)
Split ratings into two parts: the training set consisting of user-item
ratings where a fixed number of ratings corresponding to the given
ratio are preserved for each user as training data with the rest
as test. |
void |
getRatio(double trainRatio,
double validationRatio)
Split the rating into : (train-ratio) training, (validation-ratio)
validation, and test three subsets.
|
void |
getRatioByItem(double ratio)
Split ratings into two parts: the training set consisting of user-item
ratings where
ratio percentage of ratings are preserved for each
item, and the rest are used as the testing data. |
void |
getRatioByItemDate(double ratio)
Split the ratings of each item (by date) into two parts: (ratio)
training, (1-ratio) test subsets.
|
void |
getRatioByRating(double ratio)
Split ratings into two parts: (ratio) training, (1-ratio) test subsets.
|
void |
getRatioByRatingDate(double ratio)
Split the ratings (by date) into two parts: (ratio) training, (1-ratio)
test subsets.
|
void |
getRatioByUser(double ratio)
Split ratings into two parts: the training set consisting of user-item
ratings where
ratio percentage of ratings are preserved for each
user, and the rest are used as the testing data. |
void |
getRatioByUserDate(double ratio)
Split the ratings of each user (by date) into two parts: (ratio)
training, (1-ratio) test subsets
|
void |
splitData()
Split the dataset according to the configuration file.
|
getTestData, getTrainData, getValidData, setDataConvertor
getConf, setConf
public RatioDataSplitter()
public RatioDataSplitter(DataConvertor dataConvertor, Configuration conf)
RatioDataSplitter
object
with convertor and configuration.dataConvertor
- the convertor for the splitter.conf
- the configuration for the splitter.public void splitData() throws LibrecException
LibrecException
- if error occurspublic void getRatioByRating(double ratio)
ratio
- the ratio of training data over all the ratingspublic void getRatioByRatingDate(double ratio)
ratio
- the ratio of training datapublic void getRatioByUser(double ratio)
ratio
percentage of ratings are preserved for each
user, and the rest are used as the testing data.ratio
- the ratio of training datapublic void getFixedRatioByUser(double ratio)
ratio
are preserved for each user as training data with the rest
as test.ratio
- the ratio of training datapublic void getRatioByUserDate(double ratio)
ratio
- the ratio of train datapublic void getRatioByItem(double ratio)
ratio
percentage of ratings are preserved for each
item, and the rest are used as the testing data.ratio
- the ratio of training datapublic void getRatioByItemDate(double ratio)
ratio
- the ratio of training datapublic void getRatio(double trainRatio, double validationRatio)
trainRatio
- training ratiovalidationRatio
- validation ratioCopyright © 2017. All Rights Reserved.