class_docstr: Manages the privacy budget for privacy loss distributions.
  
  It manages the privacy budget for the pipeline using the
  Privacy Loss Distribution (PLD) implementation from Google's
  dp_accounting library.
  
  This class is experimental. It is not yet compatible with DPEngine.
class_docstr_tok: ["Manages","the","privacy","budget","for","privacy","loss","distributions",".","It","manages","the","privacy","budget","for","the","pipeline","using","the","Privacy","Loss","Distribution","(","PLD",")","implementation","from","Google's","dp_accounting","library",".","This","class","is","experimental",".","It","is","not","yet","compatible","with","DPEngine","."]
docstr: Uses the Privacy Loss Distribution library to compose distributions.
  
  Args:
      noise_standard_deviation: The noise of the distributions to construct.
  
  Returns:
      A PrivacyLossDistribution object for the pipeline.
docstr_tok: ["Uses","the","Privacy","Loss","Distribution","library","to","compose","distributions",".","Args",":","noise_standard_deviation",":","The","noise","of","the","distributions","to","construct",".","Returns",":","A","PrivacyLossDistribution","object","for","the","pipeline","."]
code: def _compose_distributions(
      self, noise_standard_deviation: float
  ) -> "pldlib.PrivacyLossDistribution":
      """Uses the Privacy Loss Distribution library to compose distributions.
  
      Args:
          noise_standard_deviation: The noise of the distributions to construct.
  
      Returns:
          A PrivacyLossDistribution object for the pipeline.
      """
      composed, pld = None, None
  
      for mechanism_spec_internal in self._mechanisms:
          if (
              mechanism_spec_internal.mechanism_spec.mechanism_type
              == agg_params.MechanismType.LAPLACE
          ):
              # The Laplace distribution parameter = std/sqrt(2).
              pld = pldlib.from_laplace_mechanism(
                  mechanism_spec_internal.sensitivity
                  * noise_standard_deviation
                  / math.sqrt(2)
                  / mechanism_spec_internal.weight,
                  value_discretization_interval=self._pld_discretization,
              )
          elif (
              mechanism_spec_internal.mechanism_spec.mechanism_type
              == agg_params.MechanismType.GAUSSIAN
          ):
              pld = pldlib.from_gaussian_mechanism(
                  mechanism_spec_internal.sensitivity
                  * noise_standard_deviation
                  / mechanism_spec_internal.weight,
                  value_discretization_interval=self._pld_discretization,
              )
          elif (
              mechanism_spec_internal.mechanism_spec.mechanism_type
              == agg_params.MechanismType.GENERIC
          ):
              # It is required to convert between the noise_standard_deviation of a Laplace or Gaussian mechanism
              # and the (epsilon, delta) Generic mechanism because the calibration is defined by one parameter.
              # There are multiple ways to do this; here it is assumed that (epsilon, delta) specifies the Laplace
              # mechanism and epsilon is computed based on this. The delta is computed to be proportional to epsilon.
              epsilon_0_interim = (
                  math.sqrt(2) / noise_standard_deviation
              )
              delta_0_interim = (
                  epsilon_0_interim
                  / self._total_epsilon
                  * self._total_delta
              )
              pld = pldlib.from_privacy_parameters(
                  common.DifferentialPrivacyParameters(
                      epsilon_0_interim, delta_0_interim
                  ),
                  value_discretization_interval=self._pld_discretization,
              )
  
          composed = pld if composed is None else composed.compose(pld)
  
      return composed
  
imports: import abc
  import collections
  import logging
  import math
  from typing import Optional
  from dataclasses import dataclass
  import pipeline_dp.aggregate_params
  from pipeline_dp import input_validators
label_desc: Use image node_id 6 for calling the PLDBudgetAccountant obj's underlying member method code with example usage: obj._compose_distributions(noise_standard_deviation) and returns: composed