evaluation strategies¶
Split¶
@author: Aghiles Salah
-
class
cornac.evaluation_strategies.split.
Split
(data, prop_test=0.2, prop_validation=0.0, good_rating=1.0, data_train=None, data_validation=None, data_test=None, index_train=None, index_validation=None, index_test=None)[source]¶ Evaluation Strategy Split.
Parameters: - data (scipy sparse matrix, required) – The user-item preference matrix.
- prop_test (float, optional, default: 0.2) – The propotion of the test set, if > 1 then it is treated as the size of the test set.
- prop_validation (float, optional, default: 0.0) – The propotion of the validation set, if > 1 then it is treated as the size of the validation set.
- good_rating (float, optional, default: 1) – The minimum value that is considered to be a good rating, e.g, if the ratings are in {1, …, 5}, then good_rating = 4.
- data_train (.., optional, default: None) – The training data.
- data_validation (.., optional, default: None) – The validation data.
- data_test (.., optional, default: None) – The test data.
- index_train (1d array, optional, default: None) – The indexes of training data (starting from 0).
- index_validation (1d array, optional, default: None) – The indexes of validation data (starting from 0).
- index_test (1d array, optional, default: None) – The indexes of test data (starting from 0).
- data_train_bin (.., default: None) – The binary training data.
- data_validation_bin (.., default: None) – The binary validation data.
- data_test_bin (.., default: None) – The binary test data.
Cross Validation¶
@author: Aghiles Salah
-
class
cornac.evaluation_strategies.cross_validation.
CrossValidation
(data, n_folds=5, good_rating=1.0, partition=None, data_train=None, data_validation=None, data_test=None)[source]¶ Evaluation Strategy Cross Validation.
Parameters: - data (scipy sparse matrix, required) – The user-item interaction matrix.
- n_folds (int, optional, default: 5) – The number of folds for cross validation.
- good_rating (float, optional, default: 1) – The minimum value that is considered to be a good rating, e.g, if the ratings are in {1, … ,5}, then good_rating = 4.
- partition (array-like, shape (n_observed_ratings,), optional, default: None) – The partition of ratings into n_folds (fold label of each rating) If None, random partitioning is performed to assign each rating into a fold.