def test_QuadTree(self): op_quad_tree = selection.QuadTree(self.domain_shape_2D) queries = op_quad_tree.select() if sparse.issparse(queries): queries = queries.todense() self.assertEqual(len(queries.shape), 2) self.assertEqual(queries.shape[1], 256)
def Run(self, W, x, eps, seed): x = x.flatten() prng = np.random.RandomState(seed) shape_2d = (x.shape[0]//2,2) M = selection.QuadTree(shape_2d).select() y = measurement.Laplace(M, eps).measure(x, prng) x_hat = inference.LeastSquares().infer(M, y) return x_hat
def Run(self, W, x, eps, seed): assert len(x.shape) == 2, "QuadTree only works for 2D domain" prng = np.random.RandomState(seed) shape_2d = x.shape x = x.flatten() M = selection.QuadTree(shape_2d).select() y = measurement.Laplace(M, eps).measure(x, prng) x_hat = inference.LeastSquares().infer(M, y) return x_hat
def test_QuadTree(self): op_quad_tree = selection.QuadTree(self.domain_shape_2D) queries = op_quad_tree.select() self.assertEqual(len(queries.shape), 2) self.assertEqual(queries.shape[1], 256)