comparison test_dataset.py @ 54:70147d00615a

added assert
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Tue, 29 Apr 2008 16:06:50 -0400
parents e3ac93e27e16
children 17729d7104fa
comparison
equal deleted inserted replaced
53:a1eb3dbc035d 54:70147d00615a
7 global a,ds 7 global a,ds
8 a = numpy.random.rand(10,4) 8 a = numpy.random.rand(10,4)
9 print a 9 print a
10 ds = ArrayDataSet(a,{'x':slice(3),'y':3,'z':[0,2]}) 10 ds = ArrayDataSet(a,{'x':slice(3),'y':3,'z':[0,2]})
11 print "len(ds)=",len(ds) 11 print "len(ds)=",len(ds)
12 assert(len(ds)==10)
12 print "example 0 = ",ds[0] 13 print "example 0 = ",ds[0]
14 # assert
13 print "x=",ds["x"] 15 print "x=",ds["x"]
14 print "x|y" 16 print "x|y"
15 for x,y in ds("x","y"): 17 for x,y in ds("x","y"):
16 print x,y 18 print x,y
17 minibatch_iterator = ds.minibatches(fieldnames=['z','y'],n_batches=1,minibatch_size=3,offset=4) 19 minibatch_iterator = ds.minibatches(fieldnames=['z','y'],n_batches=1,minibatch_size=3,offset=4)