SEMAlg#

class pgmpy.models.SEMAlg(eta=None, B=None, zeta=None, wedge_y=None, fixed_values=None)[source]#

Bases: object

Base class for algebraic representation of Structural Equation Models(SEMs). The model is represented using the Reticular Action Model (RAM).

generate_samples(n_samples=100)[source]#

Generates random samples from the model.

Parameters:
n_samples: int

The number of samples to generate.

Returns:
pd.DataFrame: The generated samples.
set_params(B, zeta)[source]#

Sets the fixed parameters of the model.

Parameters:
B: 2D array

The B matrix.

zeta: 2D array

The covariance matrix.

to_SEMGraph()[source]#

Creates a graph structure from the LISREL representation.

Returns:
pgmpy.models.SEMGraph instance: A path model of the model.

Examples

>>> from pgmpy.models import SEMAlg
>>> model = SEMAlg()
# TODO: Finish this example