-
Notifications
You must be signed in to change notification settings - Fork 0
/
pickle_dump.py
58 lines (44 loc) · 1.28 KB
/
pickle_dump.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import pickle
from random_loader import create_dataset as create_rand
from copious_loader import create_dataset as create_cop
random = "../data/pickle/random.pickle"
copious = "../data/pickle/copious.pickle"
copious_test = "../data/pickle/copious_test.pickle"
def dump():
"""
Helper function to write to pickle files.
"""
rand_data = create_rand()
cop_data = create_cop()
cop_test_data = create_cop(path='../data/copious_published/test')
with (open(random, 'wb')) as f:
pickle.dump(rand_data, f)
with (open(copious, 'wb')) as f:
pickle.dump(cop_data, f)
with (open(copious_test, 'wb')) as f:
pickle.dump(cop_test_data, f)
def rand_load():
"""
Helper function for loading the random dataset from pickle
"""
rand = []
with (open(random, 'rb')) as f:
rand = pickle.load(f)
return rand
def cop_load():
"""
Helper function for loading the copious dataset from pickle
"""
cop = []
with (open(copious, 'rb')) as f:
cop = pickle.load(f)
return cop
def cop_test_load():
"""
Helper function for loading the copious TEST dataset from pickle
"""
cop_test = []
with (open(copious_test, 'rb')) as f:
cop_test = pickle.load(f)
return cop_test
# dump()