Exemple #1
0
def split_test():
    "split test"
    ys = [la.rand(3), la.rand(3, 4), la.rand(2, 3, 4)]
    msg = 'Failed on shape %s, axis %s'
    for y in ys:
        for axis in range(y.ndim):
            cv = cross_validation(y.shape[axis], y.shape[axis])
            for idx_train, idx_test in cv:
                ytrain, ytest = split(y, idx_train, idx_test, axis)
                y2 = ytrain.merge(ytest)
                errmsg = msg % (str(y.shape), str(axis))
                yield assert_larry_equal, y, y2, errmsg, y
Exemple #2
0
def split_test():
    "split test"
    ys = [la.rand(3), la.rand(3,4), la.rand(2,3,4)]
    msg = 'Failed on shape %s, axis %s'
    for y in ys:
        for axis in range(y.ndim):
            cv = cross_validation(y.shape[axis], y.shape[axis])
            for idx_train, idx_test in cv:
                ytrain, ytest = split(y, idx_train, idx_test, axis)
                y2 = ytrain.merge(ytest)
                errmsg = msg % (str(y.shape), str(axis))
                yield assert_larry_equal, y, y2, errmsg, y
Exemple #3
0
 def test_sortby_12(self):
     "sortby test #12"
     lar = rand(0,2)
     theory = lar.copy()
     practice = sortby(lar, 0, 1)
     msg="Sorting empty larry failed"
     ale(theory, practice, msg=msg)
Exemple #4
0
 def test_sortby_12(self):
     "sortby test #12"
     lar = rand(0, 2)
     theory = lar.copy()
     practice = sortby(lar, 0, 1)
     msg = "Sorting empty larry failed"
     ale(theory, practice, msg=msg)
Exemple #5
0
 def test_io_2(self):
     "io_repack"
     io = IO(self.filename)
     io["larry"] = la.rand(100, 100)
     fs1 = io.freespace
     sp1 = io.space
     del io["larry"]
     io.repack()
     fs2 = io.freespace
     sp2 = io.space
     self.assert_(fs2 < fs1, "repack did not reduce freespace")
     self.assert_(sp2 < sp1, "repack did not reduce space")
Exemple #6
0
 def test_io_2(self):
     "io_repack"
     io = IO(self.filename)                
     io['larry'] = la.rand(100, 100)
     fs1 = io.freespace
     sp1 = io.space
     del io['larry']
     io.repack()
     fs2 = io.freespace
     sp2 = io.space
     self.assertTrue(fs2 < fs1, 'repack did not reduce freespace')
     self.assertTrue(sp2 < sp1, 'repack did not reduce space')
Exemple #7
0
 def test_io_2(self):
     "io_repack"
     io = IO(self.filename)
     io['larry'] = la.rand(100, 100)
     fs1 = io.freespace
     sp1 = io.space
     del io['larry']
     io.repack()
     fs2 = io.freespace
     sp2 = io.space
     self.assertTrue(fs2 < fs1, 'repack did not reduce freespace')
     self.assertTrue(sp2 < sp1, 'repack did not reduce space')
Exemple #8
0
 def test_sortby_11(self):
     "sortby test #11"
     lar = rand(0,2)
     self.assertRaises(IndexError, sortby, lar, 0, 0)
Exemple #9
0
 def test_sortby_11(self):
     "sortby test #11"
     lar = rand(0, 2)
     self.assertRaises(IndexError, sortby, lar, 0, 0)