X (str) – The covariate variable of the parameter being estimated.
Y (str) – The predictor variable of the parameter being estimated.
data (pd.DataFrame) – The data from which to learn the parameter.
ivs (List (default: None)) – List of variable names which should be used as Instrumental Variables (IV).
If not specified, tries to find the IVs from the model structure, fails if
can’t find either IV or Conditional IV.
civs (List of tuples (tuple form: (var, coditional_var))) – List of conditional IVs to use for estimation.
If not specified, tries to find the IVs from the model structure, fails if
can’t find either IV or Conditional IVs.
Estimate the parameters of the model from the data.
Parameters:
data (pandas DataFrame or pgmpy.data.Data instance) – The data from which to estimate the parameters of the model.
method (str ("ml"|"uls"|"gls"|"2sls")) – The fitting function to use.
ML : Maximum Likelihood
ULS: Unweighted Least Squares
GLS: Generalized Least Squares
2sls: 2-SLS estimator
init_values (str or dict) – Options for str: random | std | iv
dict: dictionary with keys B and zeta.
Method to compute the Weighted Least Squares fitting 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_{ULS} = tr { [(S - Sigma(theta)) W^{-1}]^2 }
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.
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.
Method to compute the Unweighted Least Squares fitting 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_{ULS} = tr[(S - Sigma(theta))^2]
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.