class_docstr: Performs DP aggregations.
class_docstr_tok: ["Performs","DP","aggregations","."]
docstr: Computes contribution bounds in a differentially private way.
  
  Computes contribution bounds for COUNT and PRIVACY_ID_COUNT
  metrics in a differentially private way.
  Currently only max_partitions_contributed is calculated.
  
  WARNINGS:
    * This API is experimental, there is a possibility that it will
      slightly change in the future.
    * It is supported only for COUNT and PRIVACY_ID_COUNT.
    * It is supported only on Beam and Local backends.
  
  Args:
    col: collection where all elements are of the same type.
    params: specifies computation parameters necessary for the algorithm.
    data_extractors: functions that extract needed pieces of
      information from elements of 'col'.
    partitions: A collection of partition keys that will be present in
      the result. It can be either the list of public partitions or
      private partitions that were selected before calling this function.
    partitions_already_filtered: if false, then filtering will be made
      and only provided partitions will be kept in col. You can set it to
      true if you have already filtered for these partitions (e.g. you
      did partition selection), it will save you some computation time.
  
  Returns:
    Collection consisting of 1 element:
    pipeline_dp.PrivateContributionBounds.
docstr_tok: ["Computes","contribution","bounds","in","a","differentially","private","way",".","Computes","contribution","bounds","for","COUNT","and","PRIVACY_ID_COUNT","metrics","in","a","differentially","private","way",".","Currently","only","max_partitions_contributed","is","calculated",".","WARNINGS",":","*","This","API","is","experimental",",","there","is","a","possibility","that","it","will","slightly","change","in","the","future",".","*","It","is","supported","only","for","COUNT","and","PRIVACY_ID_COUNT",".","*","It","is","supported","only","on","Beam","and","Local","backends",".","Args",":","col",":","collection","where","all","elements","are","of","the","same","type",".","params",":","specifies","computation","parameters","necessary","for","the","algorithm",".","data_extractors",":","functions","that","extract","needed","pieces","of","information","from","elements","of","'col","'",".","partitions",":","A","collection","of","partition","keys","that","will","be","present","in","the","result",".","It","can","be","either","the","list","of","public","partitions","or","private","partitions","that","were","selected","before","calling","this","function",".","partitions_already_filtered",":","if","false",",","then","filtering","will","be","made","and","only","provided","partitions","will","be","kept","in","col.","You","can","set","it","to","true","if","you","have","already","filtered","for","these","partitions","(","e.g",".","you","did","partition","selection",")",",","it","will","save","you","some","computation","time",".","Returns",":","Collection","consisting","of","1","element",":","pipeline_dp.PrivateContributionBounds","."]
code: def calculate_private_contribution_bounds(
      self,
      col,
      params: pipeline_dp.CalculatePrivateContributionBoundsParams,
      data_extractors: pipeline_dp.DataExtractors,
      partitions: Any,
      partitions_already_filtered: bool = False,
  ):
      """Computes contribution bounds in a differentially private way.
  
      Computes contribution bounds for COUNT and PRIVACY_ID_COUNT
      metrics in a differentially private way.
      Currently only max_partitions_contributed is calculated.
  
      WARNINGS:
        * This API is experimental, there is a possibility that it will
          slightly change in the future.
        * It is supported only for COUNT and PRIVACY_ID_COUNT.
        * It is supported only on Beam and Local backends.
  
      Args:
        col: collection where all elements are of the same type.
        params: specifies computation parameters necessary for the algorithm.
        data_extractors: functions that extract needed pieces of
          information from elements of 'col'.
        partitions: A collection of partition keys that will be present in
          the result. It can be either the list of public partitions or
          private partitions that were selected before calling this function.
        partitions_already_filtered: if false, then filtering will be made
          and only provided partitions will be kept in col. You can set it to
          true if you have already filtered for these partitions (e.g. you
          did partition selection), it will save you some computation time.
  
      Returns:
        Collection consisting of 1 element:
        pipeline_dp.PrivateContributionBounds.
      """
      self._check_calculate_private_contribution_bounds_params(
          col, params, data_extractors
      )
  
      if not partitions_already_filtered:
          col = self._drop_partitions(
              col, partitions, data_extractors.partition_extractor
          )
  
      histograms = computing_histograms.compute_dataset_histograms(
          col, data_extractors, self._backend
      )
      l0_calculator = PrivateL0Calculator(
          params, partitions, histograms, self._backend
      )
      return pipeline_functions.collect_to_container(
          self._backend,
          {"max_partitions_contributed": l0_calculator.calculate()},
          pipeline_dp.PrivateContributionBounds,
          "Collect calculated private contribution bounds into "
          "PrivateContributionBounds dataclass",
      )
  
imports: import functools
  from typing import Any, Callable, Optional, Sequence, Tuple, Union
  import pipeline_dp
  from pipeline_dp import budget_accounting
  from pipeline_dp import combiners
  from pipeline_dp import contribution_bounders
  from pipeline_dp import dp_computations
  from pipeline_dp import partition_selection
  from pipeline_dp import pipeline_functions
  from pipeline_dp import report_generator
  from pipeline_dp import sampling_utils
  from pipeline_dp.dataset_histograms import computing_histograms
  from pipeline_dp.private_contribution_bounds import PrivateL0Calculator
label_desc: Use image node_id 19 for calling the DPEngine obj's underlying member method code with example usage: obj.calculate_private_contribution_bounds(col, params, data_extractors, partitions, partitions_already_filtered) and returns: pipeline_functions