def test_bootstrap_replicate_01(self): np.random.seed(42) matrix = np.random.uniform(-1, 1, 9).reshape(3, 3) weights = np.ones((3, 1)) / 3 ss = Subspaces(dim=1) wei = ss._bootstrap_replicate(matrix, weights)[1] np.testing.assert_array_almost_equal(weights, wei)
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 = Subspaces(dim=1) 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)