class_docstr: Creates a suitable auxiliary distribution from samples of likelihood values
  
  The distribution is the CDF of a beta distribution, with
  0 -> logLmin
  1 -> 90% quantile of logLs
  0.5 -> 10% quantile of logLs
  
  .modify_Lgrad() returns the conversion from logL, grad to the
  equivalents on the auxiliary distribution.
  
  .__call__(x) returns logL, grad on the auxiliary distribution.
class_docstr_tok: ["Creates","a","suitable","auxiliary","distribution","from","samples","of","likelihood","values","The","distribution","is","the","CDF","of","a","beta","distribution",",","with","0","-",">","logLmin","1","-",">","90","%","quantile","of","logLs","0.5","-",">","10","%","quantile","of","logLs",".modify_Lgrad","(",")","returns","the","conversion","from","logL",",","grad","to","the","equivalents","on","the","auxiliary","distribution",".",".__call__","(","x",")","returns","logL",",","grad","on","the","auxiliary","distribution","."]
code: def __init__(self, d, Ls, function, layer):
      self.Lmin = Ls.min()
      self.L90 = np.percentile(Ls, 90)
      self.L10 = np.percentile(Ls, 10)
      u10 = (self.L10 - self.Lmin) / (self.L90 - self.Lmin)
  
      self.function = function
      self.layer = layer
  
      # self.alpha, self.beta = find_beta_params_static(d, u10)
      # self.alpha, self.beta = find_beta_params_dynamic(d, u10)
      self.alpha, self.beta = 1.0, 6.0
  
      self.du_dL = 1 / (self.L90 - self.Lmin)
      # print("du/dL = %g " % du_dL)
      self.C = scipy.special.beta(self.alpha, self.beta)
      self.d = d
  
      if hasattr(self.layer, "invT"):
          self.invmassmatrix = self.layer.cov
          self.massmatrix = np.linalg.inv(self.invmassmatrix)
          # print("invM:", self.invmassmatrix.shape)
      elif hasattr(self.layer, "std"):
          if np.shape(self.layer.std) == () and self.layer.std == 1:
              self.massmatrix = 1
              self.invmassmatrix = 1
          else:
              # invmassmatrix: covariance
              self.invmassmatrix = np.diag(self.layer.std[0] ** 2)
              self.massmatrix = np.diag(self.layer.std[0] ** -2)
              print(self.invmassmatrix.shape, self.layer.std)
      else:
          assert False
  
imports: import numpy
  import matplotlib.pyplot
  import scipy.special
  import scipy.stats
label_desc: Use image node_id 1 to create a new FlattenedProblem object from inherited base classes: object with example: obj = FlattenedProblem(d, Ls, function, layer)