comparison _test_dataset.py @ 22:b6b36f65664f

Created virtual sub-classes of DataSet: {Finite{Length,Width},Sliceable}DataSet, removed .field ability from LookupList (because of setattr problems), removed fieldNames() from DataSet (but is in FiniteWidthDataSet, where it makes sense), and added hasFields() instead. Fixed problems in asarray, and tested previous functionality in _test_dataset.py, but not yet new functionality.
author bengioy@esprit.iro.umontreal.ca
date Mon, 07 Apr 2008 20:44:37 -0400
parents fdf0abc490f7
children 672fe4b23032
comparison
equal deleted inserted replaced
21:fdf0abc490f7 22:b6b36f65664f
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): 51 def test_asarray(self):
52 arr = numpy.random.rand(3,4) 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)
53 a=ArrayDataSet(data=arr,fields={"x":slice(2),"y":slice(1,4)}) 57 a=ArrayDataSet(data=arr,fields={"x":slice(2),"y":slice(1,4)})
54 a_arr = numpy.asarray(a) 58 a_arr = numpy.asarray(a)
55 self.failUnless(a_arr.shape[1] == 2 + 3) 59 self.failUnless(a_arr.shape[1] == 2 + 3)
56 self.failUnless(a_arr == arr)
57 60
58 def test_minibatch_wraparound_even(self): 61 def test_minibatch_wraparound_even(self):
59 arr = numpy.random.rand(10,4) 62 arr = numpy.random.rand(10,4)
60 arr2 = ArrayDataSet.Iterator.matcat(arr,arr) 63 arr2 = ArrayDataSet.Iterator.matcat(arr,arr)
61 64