Dynamic_Dataset
(ground_truth
, path
, isZip
)
This class efficiently 'stores' a dataset. Only a list of filenames and
mappings to their ground truth values are stored in memory. The file
contents are only brought into memory when requested.
This class supports indexing, slicing, and iteration.
A user can treat an instance of this class exactly as they would a list.
Indexing an instance of this class will return a tuple consisting of
the ground truth value and the file content of the filename at that index.
A user can request the filename at an index with get_id(index)
Example:
dataset = Dynamic_Dataset(ground_truth)
print(dataset.get_id(0))
-> gitlab_79.txt
print(dataset[0])
-> ('(1,0)', 'The currently used Rails version, in the stable ...
for x in dataset[2:4]:
print(x)
-> ('(1,0)', "'In my attempt to add 2 factor authentication ...
-> ('(1,0)', 'We just had an admin accidentally push to a ...