comparison _test_dataset.py @ 26:672fe4b23032

Fixed dataset errors so that _test_dataset.py works again.
author bengioy@grenat.iro.umontreal.ca
date Fri, 11 Apr 2008 11:14:54 -0400
parents b6b36f65664f
children 541a273bc89f
comparison
equal deleted inserted replaced
23:526e192b0699 26:672fe4b23032
76 a=ArrayDataSet(data=arr,fields={"x":slice(2),"y":slice(1,4)}) 76 a=ArrayDataSet(data=arr,fields={"x":slice(2),"y":slice(1,4)})
77 77
78 for i, x in enumerate(a.minibatches(["x"], minibatch_size=3, n_batches=6)): 78 for i, x in enumerate(a.minibatches(["x"], minibatch_size=3, n_batches=6)):
79 self.failUnless(numpy.all( x == arr2[i*3:i*3+3,0:2])) 79 self.failUnless(numpy.all( x == arr2[i*3:i*3+3,0:2]))
80 80
81
82 class T_renamingdataset(unittest.TestCase):
83 def setUp(self):
84 numpy.random.seed(123456)
85
86
87 def test_hasfield(self):
88 n = numpy.random.rand(3,8)
89 a=ArrayDataSet(data=n,fields={"x":slice(2),"y":slice(1,4),"z":slice(4,6)})
90 b=a.rename({'xx':'x','zz':'z'})
91 self.failUnless(b.hasFields('xx','zz') and not b.hasFields('x') and not b.hasFields('y'))
92
93
81 if __name__ == '__main__': 94 if __name__ == '__main__':
82 unittest.main() 95 unittest.main()
83 96