-
Notifications
You must be signed in to change notification settings - Fork 8
/
pack_Data_foldb.py
45 lines (37 loc) · 1.24 KB
/
pack_Data_foldb.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
from numpy import genfromtxt
import gzip, cPickle
dirg = 'run2/'
for i in range(10):
k = i;
name1 = dirg+'/trainb_cnn'+str(k)
#train_set_x = genfromtxt(name, delimiter=',')
name2 = dirg+'/train'+str(k)+'_y'
#train_set_y = genfromtxt(name, delimiter=',')
#train_set = train_set_x, train_set_y
train_set= genfromtxt(name1, delimiter=','), genfromtxt(name2, delimiter=',')
#del train_set_x
#del train_set_y
name1 = dirg+'/testb_cnn'+str(k)
#test_set_x = genfromtxt(name, delimiter=',')
name2 = dirg+'/test'+str(k)+'_y'
#test_set_y = genfromtxt(name, delimiter=',')
#test_set = test_set_x, test_set_y
test_set = genfromtxt(name1, delimiter=','), genfromtxt(name2, delimiter=',')
#del test_set_x
#del test_set_y
name1 = dirg+'/valb_cnn'+str(k)
#val_set_x = genfromtxt(name, delimiter=',')
name2 = dirg+'/val'+str(k)+'_y'
#val_set_y = genfromtxt(name, delimiter=',')
#val_set = val_set_x, val_set_y
#del val_set_x
#del val_set_y
val_set = genfromtxt(name1, delimiter=','), genfromtxt(name2, delimiter=',')
dataset = [train_set, val_set, test_set]
del train_set
del val_set
del test_set
name = dirg+'mpqa_spab'+str(k)+'.pkl.gz'
f = gzip.open(name,'wb')
cPickle.dump(dataset, f, protocol=2)
f.close()