comparison pylearn/datasets/MNIST.py @ 1403:6ade5b39b773

int8 should be enough to represent digits from 0 to 9
author Pascal Lamblin <lamblinp@iro.umontreal.ca>
date Fri, 21 Jan 2011 20:40:57 -0500
parents a13142cbeabd
children 83d3c9ee6d65
comparison
equal deleted inserted replaced
1402:b14f3d6f5cd4 1403:6ade5b39b773
13 """Load the first MNIST examples. 13 """Load the first MNIST examples.
14 14
15 Returns two matrices: x, y. x has N rows of 784 columns. Each row of x represents the 15 Returns two matrices: x, y. x has N rows of 784 columns. Each row of x represents the
16 28x28 grey-scale pixels in raster order. y is a vector of N integers. Each element y[i] 16 28x28 grey-scale pixels in raster order. y is a vector of N integers. Each element y[i]
17 is the label of the i'th row of x. 17 is the label of the i'th row of x.
18 18
19 """ 19 """
20 if path is None: 20 if path is None:
21 path = os.path.join(data_root(), 'mnist','mnist_all.pmat') 21 path = os.path.join(data_root(), 'mnist','mnist_all.pmat')
22 22
23 dat = PMat(fname=path) 23 dat = PMat(fname=path)
24 24
25 rows=dat.getRows(0,n) 25 rows=dat.getRows(0,n)
26 26
27 return rows[:,0:-1], numpy.asarray(rows[:,-1], dtype='int64') 27 return rows[:,0:-1], numpy.asarray(rows[:,-1], dtype='int8')
28 28
29 29
30 #What is the purpose of this fct? 30 #What is the purpose of this fct?
31 #If still usefull, rename it as it conflict with the python an numpy nake all. 31 #If still usefull, rename it as it conflict with the python an numpy nake all.
32 #def all(path=None): 32 #def all(path=None):