Пример #1
0
 def _create_compound_combiner(
     self, aggregate_params: pipeline_dp.AggregateParams
 ) -> combiners.CompoundCombiner:
     mechanism_type = aggregate_params.noise_kind.convert_to_mechanism_type(
     )
     internal_combiners = []
     if not self._is_public_partitions:
         budget = self._budget_accountant.request_budget(
             mechanism_type=pipeline_dp.MechanismType.GENERIC)
         internal_combiners.append(
             utility_analysis_combiners.PartitionSelectionCombiner(
                 combiners.CombinerParams(budget, aggregate_params)))
     if pipeline_dp.Metrics.COUNT in aggregate_params.metrics:
         budget = self._budget_accountant.request_budget(
             mechanism_type, weight=aggregate_params.budget_weight)
         internal_combiners.append(
             utility_analysis_combiners.UtilityAnalysisCountCombiner(
                 combiners.CombinerParams(budget, aggregate_params)))
     if pipeline_dp.Metrics.SUM in aggregate_params.metrics:
         budget = self._budget_accountant.request_budget(
             mechanism_type, weight=aggregate_params.budget_weight)
         internal_combiners.append(
             utility_analysis_combiners.UtilityAnalysisSumCombiner(
                 combiners.CombinerParams(budget, aggregate_params)))
     if pipeline_dp.Metrics.PRIVACY_ID_COUNT in aggregate_params.metrics:
         budget = self._budget_accountant.request_budget(
             mechanism_type, weight=aggregate_params.budget_weight)
         internal_combiners.append(
             utility_analysis_combiners.
             UtilityAnalysisPrivacyIdCountCombiner(
                 combiners.CombinerParams(budget, aggregate_params)))
     return combiners.CompoundCombiner(internal_combiners,
                                       return_named_tuple=False)
Пример #2
0
 def _create_combiner(self, no_noise):
     mechanism_spec = _create_mechanism_spec(no_noise)
     aggregate_params = _create_aggregate_params()
     params = dp_combiners.CombinerParams(mechanism_spec, aggregate_params)
     return dp_combiners.CompoundCombiner([
         dp_combiners.CountCombiner(params),
         dp_combiners.SumCombiner(params)
     ])
Пример #3
0
 def _create_combiner(self, no_noise, per_partition_bound):
     mechanism_spec = _create_mechanism_spec(no_noise)
     if per_partition_bound:
         aggregate_params = self._create_aggregate_params_per_partition_bound(
         )
     else:
         aggregate_params = _create_aggregate_params()
         aggregate_params.metrics = [pipeline_dp.Metrics.SUM]
     params = dp_combiners.CombinerParams(mechanism_spec, aggregate_params)
     return dp_combiners.SumCombiner(params)
Пример #4
0
 def _create_combiner(self, no_noise):
     mechanism_spec = _create_mechanism_spec(no_noise)
     aggregate_params = _create_aggregate_params(max_value=4)
     metrics_to_compute = ['count', 'sum', 'mean']
     params = dp_combiners.CombinerParams(mechanism_spec, aggregate_params)
     return dp_combiners.MeanCombiner(params, metrics_to_compute)
Пример #5
0
 def _create_combiner(self, no_noise):
     mechanism_spec = _create_mechanism_spec(no_noise)
     aggregate_params = _create_aggregate_params()
     params = dp_combiners.CombinerParams(mechanism_spec, aggregate_params)
     return dp_combiners.PrivacyIdCountCombiner(params)
Пример #6
0
 def _create_combiner(self, no_noise, vector_size):
     mechanism_spec = _create_mechanism_spec(no_noise)
     aggregate_params = _create_aggregate_params(vector_size=vector_size)
     params = dp_combiners.CombinerParams(mechanism_spec, aggregate_params)
     return dp_combiners.VectorSumCombiner(params)