def test_hit_and_run_z(self):
        np.random.seed(42)
        df0 = np.random.normal(size=(10, 3))

        sub = ss.Subspaces()
        sub.compute(df=df0)
        W1, W2 = sub.W1, sub.W2
        m, n = W1.shape

        np.random.seed(43)
        x = np.random.uniform(-1.0, 1.0, size=(1, m))
        y = np.dot(x, W1).reshape((n, ))
        N = 10
        np.random.seed(42)
        Z = dom.hit_and_run_z(N, y, W1, W2)
Ejemplo n.º 2
0
    def test_hit_and_run_z(self):
        np.random.seed(42)
        df0 = np.random.normal(size=(10,3))

        sub = ss.Subspaces()
        sub.compute(df=df0)
        W1, W2 = sub.W1, sub.W2
        m, n = W1.shape

        np.random.seed(43)
        x = np.random.uniform(-1.0,1.0,size=(1,m))
        y = np.dot(x, W1).reshape((n, ))
        N = 10
        np.random.seed(42)
        Z = dom.hit_and_run_z(N, y, W1, W2)
Ejemplo n.º 3
0
 def test_hit_and_run_z(self):
     data = helper.load_test_npz('test_spec_decomp_1.npz')
     df0, e0, W0 = data['df'], data['e'], data['W']
     
     sub = ss.Subspaces()
     sub.compute(df0)
     W1, W2 = sub.W1, sub.W2
     m, n = W1.shape
     
     np.random.seed(43)
     x = np.random.uniform(-1.0,1.0,size=(1,m))
     y = np.dot(x, W1).reshape((n, ))
     N = 10
     np.random.seed(42)
     Z = dom.hit_and_run_z(N, y, W1, W2)
         
     #np.savez('data/test_sampling_z_0_1',Z=Z)
     data_test = helper.load_test_npz('test_sampling_z_0_1.npz')
     np.testing.assert_equal(Z, data_test['Z'])