class_docstr: Implements dp_query for accurate range queries using tree aggregation.
  
  Implements a variant of the tree aggregation protocol from. "Is interaction
  necessary for distributed private learning?. Adam Smith, Abhradeep Thakurta,
  Jalaj Upadhyay." Builds a tree on top of the input record and adds noise to
  the tree for differential privacy. Any range query can be decomposed into the
  sum of O(log(n)) nodes in the tree compared to O(n) when using a histogram.
  Improves efficiency and reduces noise scale.
class_docstr_tok: ["Implements","dp_query","for","accurate","range","queries","using","tree","aggregation",".","Implements","a","variant","of","the","tree","aggregation","protocol","from",".","``","Is","interaction","necessary","for","distributed","private","learning","?",".","Adam","Smith",",","Abhradeep","Thakurta",",","Jalaj","Upadhyay",".","''","Builds","a","tree","on","top","of","the","input","record","and","adds","noise","to","the","tree","for","differential","privacy",".","Any","range","query","can","be","decomposed","into","the","sum","of","O","(","log","(","n",")",")","nodes","in","the","tree","compared","to","O","(","n",")","when","using","a","histogram",".","Improves","efficiency","and","reduces","noise","scale","."]
docstr: Returns `TreeRangeSumQuery` with central Gaussian noise.
  
  Args:
    l2_norm_bound: Each record should be clipped so that it has L2 norm at
      most `l2_norm_bound`.
    local_stddev: Scale/stddev of the local discrete Gaussian noise.
    arity: The branching factor of the tree (i.e. the number of children each
      internal node has). Defaults to 2.
docstr_tok: ["Returns","`","TreeRangeSumQuery","`","with","central","Gaussian","noise",".","Args",":","l2_norm_bound",":","Each","record","should","be","clipped","so","that","it","has","L2","norm","at","most","`","l2_norm_bound","`",".","local_stddev",":","Scale\/stddev","of","the","local","discrete","Gaussian","noise",".","arity",":","The","branching","factor","of","the","tree","(","i.e",".","the","number","of","children","each","internal","node","has",")",".","Defaults","to","2","."]
code: def build_distributed_discrete_gaussian_query(
      cls, l2_norm_bound: float, local_stddev: float, arity: int = 2
  ):
      """Returns `TreeRangeSumQuery` with central Gaussian noise.
  
      Args:
        l2_norm_bound: Each record should be clipped so that it has L2 norm at
          most `l2_norm_bound`.
        local_stddev: Scale/stddev of the local discrete Gaussian noise.
        arity: The branching factor of the tree (i.e. the number of children each
          internal node has). Defaults to 2.
      """
      if l2_norm_bound <= 0:
          raise ValueError(
              f"`l2_clip_bound` must be positive, got {l2_norm_bound}."
          )
  
      if local_stddev < 0:
          raise ValueError(
              f"`local_stddev` must be non-negative, got {local_stddev}."
          )
  
      if arity < 2:
          raise ValueError(f"`arity` must be at least 2, got {arity}.")
  
      inner_query = distributed_discrete_gaussian_query.DistributedDiscreteGaussianSumQuery(
          l2_norm_bound, local_stddev
      )
  
      return cls(arity=arity, inner_query=inner_query)
  
file_path: privacy/tensorflow_privacy/privacy/dp_query/tree_range_query.py
imports: import distutils
  import math
  from typing import Any, NamedTuple, Optional
  import dp_accounting
  import tensorflow
  from tensorflow_privacy.privacy.dp_query import distributed_discrete_gaussian_query
  from tensorflow_privacy.privacy.dp_query import dp_query
  from tensorflow_privacy.privacy.dp_query import gaussian_query
label_desc: Use image node_id 8 for calling the TreeRangeSumQuery obj's underlying member method code with example usage: obj.build_distributed_discrete_gaussian_query(cls, l2_norm_bound, local_stddev, arity) and returns: cls