class_docstr: Distribution with piecewise linear cdf, pdf is step function
  
  can be created from empiricial distribution or from a histogram (not done yet)
  
  work in progress, not finished
class_docstr_tok: ["Distribution","with","piecewise","linear","cdf",",","pdf","is","step","function","can","be","created","from","empiricial","distribution","or","from","a","histogram","(","not","done","yet",")","work","in","progress",",","not","finished"]
docstr: Find the optimal number of bins and update the bin countaccordingly.
  Available methods : Freedman
                      Scott
docstr_tok: ["Find","the","optimal","number","of","bins","and","update","the","bin","countaccordingly",".","Available","methods",":","Freedman","Scott"]
code: def optimize_binning(self, method="Freedman"):
      """Find the optimal number of bins and update the bin countaccordingly.
      Available methods : Freedman
                          Scott
      """
  
      nobs = len(self.data)
      if method == "Freedman":
          IQR = self.ppf_emp(0.75) - self.ppf_emp(
              0.25
          )  # Interquantile range(75% -25%)
          width = 2 * IQR * nobs ** (-1.0 / 3)
  
      elif method == "Scott":
          width = 3.49 * np.std(self.data) * nobs ** (-1.0 / 3)
  
      self.nbin = np.ptp(self.binlimit) / width
      return self.nbin
  
file_path: statsmodels/statsmodels/sandbox/stats/stats_dhuard.py
imports: import scipy.interpolate
  import numpy
label_desc: Use image node_id 5 for calling the HistDist obj's underlying member method code with example usage: obj.optimize_binning(method) and returns: self