Added test on lpls, updated centering in blm, added pls_qvals

This commit is contained in:
2007-12-03 14:48:10 +00:00
parent 4c809674bb
commit 8e9c4c1c58
5 changed files with 199 additions and 68 deletions

View File

@@ -10,8 +10,8 @@ from numpy.random import rand, randn
from numpy.linalg import svd,norm
restore_path()
def blm_array(shape=(5,10), comp=3, noise=0,seed=1,dtype='d'):
assert(min(*shape)>=comp)
def blm_array(shape=(5, 10), comp=3, noise=0, seed=1, dtype='d'):
assert(min(*shape) >= comp)
random.seed(seed)
t = rand(shape[0], comp)
p = rand(shape[1], comp)
@@ -44,6 +44,7 @@ class LplsTestCase(NumpyTestCase):
pass
#raise NotImplementedError
class testAlphaZero(LplsTestCase):
def do(self):
#dat = lpls(self.a, self.b, self.c, self.nc, alpha=0.0)
@@ -51,9 +52,11 @@ class testAlphaZero(LplsTestCase):
#assert_almost_equal(t1, t2)
pass
class testAlphaOne(LplsTestCase):
pass
class testZidentity(LplsTestCase):
def do(self):
I = eye(self.a.shape[1])
@@ -61,6 +64,7 @@ class testZidentity(LplsTestCase):
dat2 = lpls(self.a, self.b, self.c, self.nc, alpha=0.0)
assert_almost_equal(dat['T'], dat2['T'])
class testYidentity(LplsTestCase):
def do(self):
I = eye(self.b.shape[0], dtype=self.a.dtype)
@@ -69,33 +73,43 @@ class testYidentity(LplsTestCase):
T = u*s
assert_almost_equal(abs(T0), abs(T[:,:self.nc]),5)
class testWideX(LplsTestCase):
pass
class testTallX(LplsTestCase):
pass
class testWideY(LplsTestCase):
pass
class testTallY(LplsTestCase):
pass
class testWideZ(LplsTestCase):
pass
class testTallZ(LplsTestCase):
pass
class testRankDeficientX(LplsTestCase):
pass
class testRankDeficientY(LplsTestCase):
pass
class testRankDeficientZ(LplsTestCase):
pass
class testCenterX(LplsTestCase):
def do(self):
T = lpls(self.a, self.b, self.c, self.nc, mean_ctr=[0,-1,-1])['T']