comparison datasets/MNIST.py @ 471:45b3eb429c15

added train_valid_test
author James Bergstra <bergstrj@iro.umontreal.ca>
date Thu, 23 Oct 2008 13:26:11 -0400
parents bd937e845bbb
children 11e0357f06f4
comparison
equal deleted inserted replaced
470:bd937e845bbb 471:45b3eb429c15
27 27
28 def all(path=None): 28 def all(path=None):
29 return head(n=None, path=path) 29 return head(n=None, path=path)
30 30
31 31
32 def train_valid_test(path=None, ntrain=50000, nvalid=10000, ntest=10000):
33 all_x, all_targ = all(path=path)
34
35 train = all_x[0:ntrain], all_targ[0:ntrain]
36 valid = all_x[ntrain:ntrain+nvalid], all_targ[ntrain:ntrain+nvalid]
37 test = all_x[ntrain+nvalid:ntrain+nvalid+ntest], all_targ[ntrain+nvalid:ntrain+nvalid+ntest]
38
39 return train, valid, test
40