def testCovExecution(self): data = np.array([[0, 2], [1, 1], [2, 0]]).T x = tensor(data, chunk_size=1) t = cov(x) res = self.executor.execute_tensor(t, concat=True)[0] expected = np.cov(data) np.testing.assert_equal(res, expected) data_x = [-2.1, -1, 4.3] data_y = [3, 1.1, 0.12] x = tensor(data_x, chunk_size=1) y = tensor(data_y, chunk_size=1) X = stack((x, y), axis=0) t = cov(x, y) r = tall(t == cov(X)) self.assertTrue(self.executor.execute_tensor(r)[0])
def test_cov_execution(setup): data = np.array([[0, 2], [1, 1], [2, 0]]).T x = tensor(data, chunk_size=1) t = cov(x) res = t.execute().fetch() expected = np.cov(data) np.testing.assert_equal(res, expected) data_x = [-2.1, -1, 4.3] data_y = [3, 1.1, 0.12] x = tensor(data_x, chunk_size=1) y = tensor(data_y, chunk_size=1) X = stack((x, y), axis=0) t = cov(x, y) r = tall(t == cov(X)) assert r.execute().fetch()