Exemplo n.º 1
0
    def test_no_privacy_average(self):
        with self.cached_session() as sess:
            record1 = tf.constant([5.0, 0.0])
            record2 = tf.constant([-1.0, 2.0])

            query = no_privacy_query.NoPrivacyAverageQuery()
            query_result, _ = test_utils.run_query(query, [record1, record2])
            result = sess.run(query_result)
            expected = [2.0, 1.0]
            self.assertAllClose(result, expected)
Exemplo n.º 2
0
    def test_no_privacy_weighted_average(self):
        with self.cached_session() as sess:
            record1 = tf.constant([4.0, 0.0])
            record2 = tf.constant([-1.0, 1.0])

            weights = [1, 3]

            query = no_privacy_query.NoPrivacyAverageQuery()
            query_result, _ = test_utils.run_query(query, [record1, record2],
                                                   weights=weights)
            result = sess.run(query_result)
            expected = [0.25, 0.75]
            self.assertAllClose(result, expected)
Exemplo n.º 3
0
 def _construct_below_estimate_query(self, below_estimate_stddev,
                                     expected_num_records):
     del below_estimate_stddev
     del expected_num_records
     return no_privacy_query.NoPrivacyAverageQuery()