class_docstr: Base class of SEM estimators. All the estimators inherit this class.
class_docstr_tok: ["Base","class","of","SEM","estimators",".","All","the","estimators","inherit","this","class","."]
docstr: Computes the starting values for the optimizer.
  
  Reference
  ---------
  .. [1] Table 4C.1: Bollen, K. (2014). Structural Equations with Latent Variables.
          New York, NY: John Wiley & Sons.
docstr_tok: ["Computes","the","starting","values","for","the","optimizer",".","Reference","--","--","--","--","-","..","[","1","]","Table","4C.1",":","Bollen",",","K.","(","2014",")",".","Structural","Equations","with","Latent","Variables",".","New","York",",","NY",":","John","Wiley","&","Sons","."]
code: def get_init_values(self, data, method):
      """
      Computes the starting values for the optimizer.
  
      Reference
      ---------
      .. [1] Table 4C.1: Bollen, K. (2014). Structural Equations with Latent Variables.
              New York, NY: John Wiley & Sons.
  
      """
      # Initialize all the values even if the edge doesn't exist, masks would take care of that.
      a = 0.4
      scaling_vars = self.model.to_SEMGraph().get_scaling_indicators()
      eta, m = self.model.eta, len(self.model.eta)
  
      if method == "random":
          B = np.random.rand(m, m)
          zeta = np.random.rand(m, m)
  
      elif method == "std":
          # Add observed vars to `scaling_vars to point to itself. Trick to keep code short.
          for observed_var in self.model.y:
              scaling_vars[observed_var] = observed_var
  
          B = np.random.rand(m, m)
          for i in range(m):
              for j in range(m):
                  if scaling_vars[eta[i]] == eta[j]:
                      B[i, j] = 1.0
                  elif i != j:
                      B[i, j] = a * (
                          data.loc[:, scaling_vars[eta[i]]].std()
                          / data.loc[:, scaling_vars[eta[j]]].std()
                      )
          zeta = np.random.rand(m, m)
          for i in range(m):
              zeta[i, i] = a * (
                  (data.loc[:, scaling_vars[eta[i]]].std()) ** 2
              )
          for i in range(m):
              for j in range(m):
                  zeta[i, j] = zeta[j, i] = a * np.sqrt(
                      zeta[i, i] * zeta[j, j]
                  )
  
      elif method.lower() == "iv":
          raise NotImplementedError(
              "IV initialization not supported yet."
          )
  
      return B, zeta
  
file_path: pgmpy/pgmpy/estimators/SEMEstimator.py
imports: import numpy
  import pandas
  import statsmodels.api
  import torch
  from pgmpy import config
  from pgmpy.models import SEM, SEMAlg, SEMGraph
  from pgmpy.utils import optimize, pinverse
label_desc: Use image node_id 6 for calling the SEMEstimator obj's underlying member method code with example usage: obj.get_init_values(data, method) and returns: B,  zeta