Mercurial > pylearn
comparison _test_dataset.py @ 28:541a273bc89f
Removed __array__ method from dataset, whose
semantics did not have a clear use (because of the
possibility of overlapping fields).
author | bengioy@grenat.iro.umontreal.ca |
---|---|
date | Fri, 11 Apr 2008 13:08:51 -0400 |
parents | 672fe4b23032 |
children | 46c5c90019c2 |
comparison
equal
deleted
inserted
replaced
27:e6c550cb2896 | 28:541a273bc89f |
---|---|
46 arr = numpy.random.rand(10,4) | 46 arr = numpy.random.rand(10,4) |
47 a=ArrayDataSet(data=arr,fields={"x":slice(2),"y":slice(1,4)}) | 47 a=ArrayDataSet(data=arr,fields={"x":slice(2),"y":slice(1,4)}) |
48 a_y = a.y | 48 a_y = a.y |
49 self.failUnless(numpy.all( a_y == arr[:,1:4])) | 49 self.failUnless(numpy.all( a_y == arr[:,1:4])) |
50 | 50 |
51 def test_asarray(self): | |
52 arr = numpy.random.rand(3,4) | |
53 a=ArrayDataSet(data=arr,fields={"x":slice(2),"y":slice(2,4)}) | |
54 a_arr = numpy.asarray(a) | |
55 self.failUnless(a_arr.shape[1] == 2 + 2) | |
56 self.failUnless(numpy.sum(numpy.square(a_arr-a.data))==0) | |
57 a=ArrayDataSet(data=arr,fields={"x":slice(2),"y":slice(1,4)}) | |
58 a_arr = numpy.asarray(a) | |
59 self.failUnless(a_arr.shape[1] == 2 + 3) | |
60 | |
61 def test_minibatch_wraparound_even(self): | 51 def test_minibatch_wraparound_even(self): |
62 arr = numpy.random.rand(10,4) | 52 arr = numpy.random.rand(10,4) |
63 arr2 = ArrayDataSet.Iterator.matcat(arr,arr) | 53 arr2 = ArrayDataSet.Iterator.matcat(arr,arr) |
64 | 54 |
65 a=ArrayDataSet(data=arr,fields={"x":slice(2),"y":slice(1,4)}) | 55 a=ArrayDataSet(data=arr,fields={"x":slice(2),"y":slice(1,4)}) |