docstr: Number of samples needed to estimate the population variance within the tolerance limit
  Sample variance is normally distributed http://stats.stackexchange.com/a/105338/71884
  (see warning below).
  Var(s^2) /approx 1/n * (\loc_4 - \scale^4)
  Adjust n as per the tolerance needed to estimate the sample variance
  warning: does not work for some distributions like bernoulli - https://stats.stackexchange.com/a/104911
  use the min_samples for explicitly controlling the number of samples to be drawn
docstr_tok: ["Number","of","samples","needed","to","estimate","the","population","variance","within","the","tolerance","limit","Sample","variance","is","normally","distributed","http",":","\/\/stats.stackexchange.com\/a\/105338\/71884","(","see","warning","below",")",".","Var","(","s^2",")","\/approx","1\/n","*","(","\\loc_4","-","\\scale^4",")","Adjust","n","as","per","the","tolerance","needed","to","estimate","the","sample","variance","warning",":","does","not","work","for","some","distributions","like","bernoulli","-","https",":","\/\/stats.stackexchange.com\/a\/104911","use","the","min_samples","for","explicitly","controlling","the","number","of","samples","to","be","drawn"]
code: def get_num_samples(self, idx):
      r"""
      Number of samples needed to estimate the population variance within the tolerance limit
      Sample variance is normally distributed http://stats.stackexchange.com/a/105338/71884
      (see warning below).
      Var(s^2) /approx 1/n * (\loc_4 - \scale^4)
      Adjust n as per the tolerance needed to estimate the sample variance
      warning: does not work for some distributions like bernoulli - https://stats.stackexchange.com/a/104911
      use the min_samples for explicitly controlling the number of samples to be drawn
      """
      if self.min_samples:
          return self.min_samples
      min_samples = 1000
      tol = 10.0
      required_precision = self.prec / tol
      if not self.scipy_dist:
          return min_samples
      args, kwargs = self.scipy_arg_fn(
          **self.get_dist_params(idx, wrap_tensor=False)
      )
      try:
          fourth_moment = np.max(
              self.scipy_dist.moment(4, *args, **kwargs)
          )
          var = np.max(self.scipy_dist.var(*args, **kwargs))
          min_computed_samples = int(
              math.ceil(
                  (fourth_moment - math.pow(var, 2))
                  / required_precision
              )
          )
      except (AttributeError, ValueError):
          return min_samples
      return max(min_samples, min_computed_samples)
  
imports: import math
  import numpy
  import torch
  from torch.distributions.utils import logits_to_probs
  from pyro.distributions.util import broadcast_shape
label_desc: Use image node_id 13 for calling the Fixture obj's underlying member method code with example usage: obj.get_num_samples(idx) and returns: max, self, min_samples, min_samples