comparison test_dataset.py @ 63:14589f02a372

more test
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Fri, 02 May 2008 10:14:24 -0400
parents 9165d86855ab
children 863da25a60f1
comparison
equal deleted inserted replaced
62:23bf2c9eb7b3 63:14589f02a372
64 # for var in minibatch: 64 # for var in minibatch:
65 # print "var=",var 65 # print "var=",var
66 # print "take a slice and look at field y",ds[1:6:2]["y"] 66 # print "take a slice and look at field y",ds[1:6:2]["y"]
67 have_thrown = False 67 have_thrown = False
68 try: 68 try:
69 ds['h'] 69 ds['h'] # h is not defined...
70 except : 70 except :
71 have_thrown = True 71 have_thrown = True
72 assert have_thrown == True 72 assert have_thrown == True
73 assert ds == ds.fields().examples() 73 assert len(ds.fields())==3
74 for field in ds.fields(): 74 for field in ds.fields():
75 for field_value in field: # iterate over the values associated to that field for all the ds examples 75 for field_value in field: # iterate over the values associated to that field for all the ds examples
76 pass 76 pass
77 for field in ds('x','z').fields(): 77 for field in ds('x','z').fields():
78 pass 78 pass
79 for field in ds.fields('x','y'): 79 for field in ds.fields('x','y'):
80 pass 80 pass
81 for field_examples in ds.fields(): 81 for field_examples in ds.fields():
82 for example_value in field_examples: 82 for example_value in field_examples:
83 pass 83 pass
84
85 assert ds == ds.fields().examples()
86
87
88 #test missing value
89
90 assert len(ds[:3])==3
91 for x,z in ds[:3]('x','z'):
92 assert ds[i]['z'].all()==a[i][0:3:2].all()
93
94 #ds[i1:i2:s]# returns a ds with the examples i1,i1+s,...i2-s.
95
96 #ds[i]# returns an Example.
97
98 #ds[[i1,i2,...in]]# returns a ds with examples i1,i2,...in.
99
100 #ds[fieldname]# an iterable over the values of the field fieldname across
101 #the ds (the iterable is obtained by default by calling valuesVStack
102 #over the values for individual examples).
103
104 #ds.<property># returns the value of a property associated with
105 #the name <property>. The following properties should be supported:
106 # - 'description': a textual description or name for the ds
107 # - 'fieldtypes': a list of types (one per field)
108 #* ds1 | ds2 | ds3 == ds.hstack([ds1,ds2,ds3])
109 #* ds1 & ds2 & ds3 == ds.vstack([ds1,ds2,ds3])
110
111
84 test_ArrayDataSet() 112 test_ArrayDataSet()
85 113