class_docstr: Differential privacy (DP) epsilon lower bound.
  
  This class computes a statistical epsilon lower bound by looking at the log
  ratio of tpr and fpr. The tpr / fpr ratio bound is from `RatioBound` class.
  
  For example, in membership inference attack, the attacker sets a threshold and
  predicts samples with top probability larger than the thresholds as member.
  If the model is trained withs DP guarantee, then we should expect
  log(tpr / fpr) <= epsilon, where tpr and fpr are the true positive and false
  positive rates of the attacker. Therefore, we can use log(tpr / fpr) to derive
  an epsilon lower bound.
  
  The idea of using Clopper Pearson for estimating epsilon lower bound is from
  https://arxiv.org/pdf/2006.07709.pdf.
  The idea of using log Katz is from https://arxiv.org/pdf/2210.08643.pdf.
  
  Examples:
    >>> lb = elb.EpsilonLowerBound(train_top_probs, test_top_probs, alpha=0.05)
    >>> methods = [BoundMethod.BAILEY, BoundMethod.KATZ_LOG]
    >>> lb.compute_epsilon_lower_bounds(methods, k=5)
class_docstr_tok: ["Differential","privacy","(","DP",")","epsilon","lower","bound",".","This","class","computes","a","statistical","epsilon","lower","bound","by","looking","at","the","log","ratio","of","tpr","and","fpr",".","The","tpr","\/","fpr","ratio","bound","is","from","`","RatioBound","`","class",".","For","example",",","in","membership","inference","attack",",","the","attacker","sets","a","threshold","and","predicts","samples","with","top","probability","larger","than","the","thresholds","as","member",".","If","the","model","is","trained","withs","DP","guarantee",",","then","we","should","expect","log","(","tpr","\/","fpr",")","<","=","epsilon",",","where","tpr","and","fpr","are","the","true","positive","and","false","positive","rates","of","the","attacker",".","Therefore",",","we","can","use","log","(","tpr","\/","fpr",")","to","derive","an","epsilon","lower","bound",".","The","idea","of","using","Clopper","Pearson","for","estimating","epsilon","lower","bound","is","from","https",":","\/\/arxiv.org\/pdf\/2006.07709.pdf",".","The","idea","of","using","log","Katz","is","from","https",":","\/\/arxiv.org\/pdf\/2210.08643.pdf",".","Examples",":",">",">",">","lb","=","elb.EpsilonLowerBound","(","train_top_probs",",","test_top_probs",",","alpha=0.05",")",">",">",">","methods","=","[","BoundMethod.BAILEY",",","BoundMethod.KATZ_LOG","]",">",">",">","lb.compute_epsilon_lower_bounds","(","methods",",","k=5",")"]
docstr: Computes lower bound w/ a specified method and returns top-k epsilons.
  
  Args:
    method: the method to use for ratio bound.
    k: if specified, will return top-k values.
  
  Returns:
    An array of bounds.
docstr_tok: ["Computes","lower","bound","w\/","a","specified","method","and","returns","top-k","epsilons",".","Args",":","method",":","the","method","to","use","for","ratio","bound",".","k",":","if","specified",",","will","return","top-k","values",".","Returns",":","An","array","of","bounds","."]
code: def compute_epsilon_lower_bound(
      self, method: BoundMethod, k: Optional[int] = None
  ) -> npt.NDArray[float]:
      """Computes lower bound w/ a specified method and returns top-k epsilons.
  
      Args:
        method: the method to use for ratio bound.
        k: if specified, will return top-k values.
  
      Returns:
        An array of bounds.
      """
      if method not in self._rbs[0].available_methods:
          raise ValueError(f"Method {method} not recognized.")
      ratio_bound = np.concatenate(
          [rb.compute_bound(method) for rb in self._rbs]
      )
      bounds = np.log(ratio_bound[ratio_bound > 0])
      bounds = np.sort(bounds)[::-1]
      if k is None or k >= bounds.size:
          return bounds
      return bounds[:k]
  
imports: import enum
  import numbers
  from typing import Dict, Iterable, Optional, Sequence, Union
  import immutabledict
  import numpy
  import numpy.typing
  import scipy.integrate
  import scipy.optimize
  import scipy.stats
  import sklearn.metrics
  from statsmodels.stats import proportion
label_desc: Use image node_id 2 for calling the EpsilonLowerBound obj's underlying member method code with example usage: obj.compute_epsilon_lower_bound(method, k) and returns: bounds, bounds