KFold partitioning technique
KFoldPartitioning(n_splits=2, shuffle=True, random_state=None, skip_user_error=True)
Bases: Partitioning
Class that performs K-Fold partitioning
PARAMETER | DESCRIPTION |
---|---|
n_splits |
Number of splits. Must be at least 2
TYPE:
|
shuffle |
Whether to shuffle the data before splitting into batches. Note that the samples within each split will not be shuffled.
TYPE:
|
random_state |
When
TYPE:
|
skip_user_error |
If set to True, users for which data can't be split will be skipped and only a warning will be logged at the
end of the split process specifying n° of users skipped. Otherwise, a
TYPE:
|
Source code in clayrs/recsys/partitioning.py
157 158 159 160 161 |
|
split_single(uir_user)
Method which splits in \(k\) splits both in train set and test set the ratings of a single user
PARAMETER | DESCRIPTION |
---|---|
uir_user |
uir matrix containing interactions of a single user |
RETURNS | DESCRIPTION |
---|---|
List[np.ndarray]
|
The first list contains a uir matrix for each split constituting the train set of the user |
List[np.ndarray]
|
The second list contains a uir matrix for each split constituting the test set of the user |
Source code in clayrs/recsys/partitioning.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|