Ejemplo n.º 1
0
 def test_bootstrap_replicate_03(self):
     np.random.seed(42)
     matrix = np.random.uniform(-1, 1, 27).reshape(3, 3, 3)
     weights = np.ones((3, 1)) / 3
     ss = ActiveSubspaces()
     wei = ss._bootstrap_replicate(matrix, weights)[1]
     np.testing.assert_array_almost_equal(weights, wei)
Ejemplo n.º 2
0
 def test_bootstrap_replicate_02(self):
     np.random.seed(42)
     matrix = np.random.uniform(-1, 1, 9).reshape(3, 3)
     weights = np.ones((3, 1)) / 3
     ss = ActiveSubspaces()
     mat = ss._bootstrap_replicate(matrix, weights)[0]
     true_matrix = np.array([[-0.88383278, 0.73235229, 0.20223002],
                             [0.19731697, -0.68796272, -0.68801096],
                             [-0.25091976, 0.90142861, 0.46398788]])
     np.testing.assert_array_almost_equal(true_matrix, mat)
Ejemplo n.º 3
0
 def test_bootstrap_replicate_04(self):
     np.random.seed(42)
     matrix = np.random.uniform(-1, 1, 27).reshape(3, 3, 3)
     weights = np.ones((3, 1)) / 3
     ss = ActiveSubspaces()
     mat = ss._bootstrap_replicate(matrix, weights)[0]
     true_matrix = np.array([[[-0.13610996, -0.41754172, 0.22370579],
                              [-0.72101228, -0.4157107, -0.26727631],
                              [-0.08786003, 0.57035192, -0.60065244]],
                             [[-0.25091976, 0.90142861, 0.46398788],
                              [0.19731697, -0.68796272, -0.68801096],
                              [-0.88383278, 0.73235229, 0.20223002]],
                             [[-0.13610996, -0.41754172, 0.22370579],
                              [-0.72101228, -0.4157107, -0.26727631],
                              [-0.08786003, 0.57035192, -0.60065244]]])
     np.testing.assert_array_almost_equal(true_matrix, mat)