class_docstr: Base class for budget accountants.
class_docstr_tok: ["Base","class","for","budget","accountants","."]
docstr: Computes budget per aggregation.
  
  It splits the budget using the naive composition.
  
  Warning: This function changes the 'self' internal state. It can be
  called only from the API function of DPEngine, like aggregate() or
  select_partitions().
  
  Args:
      weight: the budget weight of the aggregation.
  
  Returns:
      the budget.
docstr_tok: ["Computes","budget","per","aggregation",".","It","splits","the","budget","using","the","naive","composition",".","Warning",":","This","function","changes","the","'self","'","internal","state",".","It","can","be","called","only","from","the","API","function","of","DPEngine",",","like","aggregate","(",")","or","select_partitions","(",")",".","Args",":","weight",":","the","budget","weight","of","the","aggregation",".","Returns",":","the","budget","."]
code: def _compute_budget_for_aggregation(self, weight: float) -> Budget:
      """Computes budget per aggregation.
  
      It splits the budget using the naive composition.
  
      Warning: This function changes the 'self' internal state. It can be
      called only from the API function of DPEngine, like aggregate() or
      select_partitions().
  
      Args:
          weight: the budget weight of the aggregation.
  
      Returns:
          the budget.
      """
      self._actual_aggregation_weights.append(weight)
      if self._expected_num_aggregations:
          return Budget(
              self._total_epsilon / self._expected_num_aggregations,
              self._total_delta / self._expected_num_aggregations,
          )
      if self._expected_aggregation_weights:
          budget_ratio = weight / sum(
              self._expected_aggregation_weights
          )
          return Budget(
              self._total_epsilon * budget_ratio,
              self._total_delta * budget_ratio,
          )
      # No expectations on aggregations, no way to compute budget.
      return None
  
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 5 for calling the BudgetAccountant obj's underlying member method code with example usage: obj._compute_budget_for_aggregation(weight) and returns: None, Budget, Budget