Added comments to give context to the folds

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2019-02-08 10:46:00 +01:00
parent 3f08c54679
commit ce6cda5351

View File

@ -58,12 +58,12 @@ def train_mnist(folding_id: int, inlier_classes: Sequence[int], total_classes: i
mnist_valid = [] mnist_valid = []
for i in range(folds): for i in range(folds):
if i != folding_id: if i != folding_id: # exclude testing fold, representing 20% of each class
with open('data/data_fold_%d.pkl' % i, 'rb') as pkl: with open('data/data_fold_%d.pkl' % i, 'rb') as pkl:
fold = pickle.load(pkl) fold = pickle.load(pkl)
if len(mnist_valid) == 0: if len(mnist_valid) == 0: # single out one fold, comprising 20% of each class
mnist_valid = fold mnist_valid = fold
else: else: # form train set from remaining folds, comprising 60% of each class
mnist_train += fold mnist_train += fold
outlier_classes = [] outlier_classes = []