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: Method to compute the Maximum Likelihood loss function. The optimizer calls this
  method after each iteration with updated params to compute the new loss.
  
  The fitting function for ML is:
  .. math:: F_{ML} = \log |\Sigma(\theta)| + tr(S \Sigma^{-1}(\theta)) - \log S - (p+q)
  
  Parameters
  ----------
  params: dict
      params contain all the variables which are updated in each iteration of the
      optimization.
  
  loss_args: dict
      loss_args contain all the variable which are not updated in each iteration but
      are required to compute the loss.
  
  Returns
  -------
  torch.tensor: The loss value for the given params and loss_args
docstr_tok: ["Method","to","compute","the","Maximum","Likelihood","loss","function",".","The","optimizer","calls","this","method","after","each","iteration","with","updated","params","to","compute","the","new","loss",".","The","fitting","function","for","ML","is",":","..","math",":",":","F_","{","ML","}","=","\\log","|\\Sigma","(","\\theta",")","|","+","tr","(","S","\\Sigma^","{","-1","}","(","\\theta",")",")","-","\\log","S","-","(","p+q",")","Parameters","--","--","--","--","--","params",":","dict","params","contain","all","the","variables","which","are","updated","in","each","iteration","of","the","optimization",".","loss_args",":","dict","loss_args","contain","all","the","variable","which","are","not","updated","in","each","iteration","but","are","required","to","compute","the","loss",".","Returns","--","--","--","-","torch.tensor",":","The","loss","value","for","the","given","params","and","loss_args"]
code: def ml_loss(self, params, loss_args):
      r"""
      Method to compute the Maximum Likelihood loss function. The optimizer calls this
      method after each iteration with updated params to compute the new loss.
  
      The fitting function for ML is:
      .. math:: F_{ML} = \log |\Sigma(\theta)| + tr(S \Sigma^{-1}(\theta)) - \log S - (p+q)
  
      Parameters
      ----------
      params: dict
          params contain all the variables which are updated in each iteration of the
          optimization.
  
      loss_args: dict
          loss_args contain all the variable which are not updated in each iteration but
          are required to compute the loss.
  
      Returns
      -------
      torch.tensor: The loss value for the given params and loss_args
      """
      S = loss_args["S"]
      sigma = self._get_implied_cov(params["B"], params["zeta"])
  
      return (
          sigma.det().clamp(min=1e-4).log()
          + (S @ pinverse(sigma)).trace()
          - S.logdet()
          - len(self.model.y)
      )
  
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 3 for calling the SEMEstimator obj's underlying member method code with example usage: obj.ml_loss(params, loss_args) and returns: unknown