class_docstr: Class for representing Structural Equation Models. This class is a wrapper over
  `SEMGraph` and `SEMAlg` to provide a consistent API over the different representations.
  
  Attributes
  ----------
  model: SEMGraph instance
      A graphical representation of the model.
class_docstr_tok: ["Class","for","representing","Structural","Equation","Models",".","This","class","is","a","wrapper","over","`","SEMGraph","`","and","`","SEMAlg","`","to","provide","a","consistent","API","over","the","different","representations",".","Attributes","--","--","--","--","--","model",":","SEMGraph","instance","A","graphical","representation","of","the","model","."]
docstr: Initializes a `SEM` instance using lavaan syntax.
  
  Parameters
  ----------
  string: str (default: None)
      A `lavaan` style multiline set of regression equation representing the model.
      Refer http://lavaan.ugent.be/tutorial/syntax1.html for details.
  
  filename: str (default: None)
      The filename of the file containing the model in lavaan syntax.
  
  Examples
  --------
docstr_tok: ["Initializes","a","`","SEM","`","instance","using","lavaan","syntax",".","Parameters","--","--","--","--","--","string",":","str","(","default",":","None",")","A","`","lavaan","`","style","multiline","set","of","regression","equation","representing","the","model",".","Refer","http",":","\/\/lavaan.ugent.be\/tutorial\/syntax1.html","for","details",".","filename",":","str","(","default",":","None",")","The","filename","of","the","file","containing","the","model","in","lavaan","syntax",".","Examples","--","--","--","--"]
code: def from_lavaan(cls, string=None, filename=None):
      """
      Initializes a `SEM` instance using lavaan syntax.
  
      Parameters
      ----------
      string: str (default: None)
          A `lavaan` style multiline set of regression equation representing the model.
          Refer http://lavaan.ugent.be/tutorial/syntax1.html for details.
  
      filename: str (default: None)
          The filename of the file containing the model in lavaan syntax.
  
      Examples
      --------
      """
      if filename:
          with open(filename, "r") as f:
              lavaan_str = f.readlines()
      elif string:
          lavaan_str = string.split("\n")
      else:
          raise ValueError(
              "Either `filename` or `string` need to be specified"
          )
  
      return cls(syntax="lavaan", lavaan_str=lavaan_str)
  
imports: import itertools
  import networkx
  import numpy
  import pandas
  from networkx.algorithms.dag import descendants
  from pyparsing import OneOrMore, Optional, Suppress, Word, alphanums, nums
  from pgmpy.base import DAG
  from pgmpy.global_vars import logger
label_desc: Use image node_id 2 for calling the SEM obj's underlying member method code with example usage: obj.from_lavaan(cls, string, filename) and returns: cls