MultiGroupDirectLiNGAM¶
-
class
lingam.
MultiGroupDirectLiNGAM
(random_state=None, prior_knowledge=None, apply_prior_knowledge_softly=False)[source]¶ Implementation of DirectLiNGAM Algorithm with multiple groups [1]
References
[1] (1, 2) - Shimizu. Joint estimation of linear non-Gaussian acyclic models. Neurocomputing, 81: 104-107, 2012.
-
__init__
(random_state=None, prior_knowledge=None, apply_prior_knowledge_softly=False)[source]¶ Construct a model.
Parameters: - random_state (int, optional (default=None)) –
random_state
is the seed used by the random number generator. - prior_knowledge (array-like, shape (n_features, n_features), optional (default=None)) –
Prior knowledge used for causal discovery, where
n_features
is the number of features.The elements of prior knowledge matrix are defined as follows [1]:
0
: \(x_i\) does not have a directed path to \(x_j\)1
: \(x_i\) has a directed path to \(x_j\)-1
: No prior knowledge is available to know if either of the two cases above (0 or 1) is true.
- apply_prior_knowledge_softly (boolean, optional (default=False)) – If True, apply prior knowledge softly.
- random_state (int, optional (default=None)) –
-
adjacency_matrices_
¶ Estimated adjacency matrices.
Returns: adjacency_matrices_ – The list of adjacency matrix B for multiple datasets. The shape of B is (n_features, n_features), where n_features is the number of features. Return type: array-like, shape (B, ..)
-
adjacency_matrix_
¶ Estimated adjacency matrix.
Returns: adjacency_matrix_ – The adjacency matrix B of fitted model, where n_features is the number of features. Return type: array-like, shape (n_features, n_features)
-
bootstrap
(X_list, n_sampling)[source]¶ Evaluate the statistical reliability of DAG based on the bootstrapping.
Parameters: - X_list (array-like, shape (X, ..)) – Multiple datasets for training, where
X
is an dataset. The shape of ‘’X’’ is (n_samples, n_features), wheren_samples
is the number of samples andn_features
is the number of features. - n_sampling (int) – Number of bootstrapping samples.
Returns: results – Returns the results of bootstrapping for multiple datasets.
Return type: array-like, shape (BootstrapResult, ..)
- X_list (array-like, shape (X, ..)) – Multiple datasets for training, where
-
causal_order_
¶ Estimated causal ordering.
Returns: causal_order_ – The causal order of fitted model, where n_features is the number of features. Return type: array-like, shape (n_features)
-
estimate_total_effect
(X_list, from_index, to_index)[source]¶ Estimate total effect using causal model.
Parameters: - X_list (array-like, shape (X, ..)) – Multiple datasets for training, where
X
is an dataset. The shape of ‘’X’’ is (n_samples, n_features), wheren_samples
is the number of samples andn_features
is the number of features. - from_index – Index of source variable to estimate total effect.
- to_index – Index of destination variable to estimate total effect.
Returns: total_effect – Estimated total effect.
Return type: float
- X_list (array-like, shape (X, ..)) – Multiple datasets for training, where
-
fit
(X_list)[source]¶ Fit the model to multiple datasets.
Parameters: X_list (list, shape [X, ..]) – Multiple datasets for training, where X
is an dataset. The shape of ‘’X’’ is (n_samples, n_features), wheren_samples
is the number of samples andn_features
is the number of features.Returns: self – Returns the instance itself. Return type: object
-
get_error_independence_p_values
(X_list)[source]¶ Calculate the p-value matrix of independence between error variables.
Parameters: X_list (array-like, shape (X, ..)) – Multiple datasets for training, where X
is an dataset. The shape of ‘’X’’ is (n_samples, n_features), wheren_samples
is the number of samples andn_features
is the number of features.Returns: independence_p_values – p-value matrix of independence between error variables. Return type: array-like, shape (n_datasets, n_features, n_features)