DirectLiNGAM¶

class
lingam.
DirectLiNGAM
(random_state=None, prior_knowledge=None, apply_prior_knowledge_softly=False, measure='pwling')[source]¶ Implementation of DirectLiNGAM Algorithm [1] [2]
References
[1] (1, 2, 3) S. Shimizu, T. Inazumi, Y. Sogawa, A. Hyvärinen, Y. Kawahara, T. Washio, P. O. Hoyer and K. Bollen. DirectLiNGAM: A direct method for learning a linear nonGaussian structural equation model. Journal of Machine Learning Research, 12(Apr): 1225–1248, 2011. [2] (1, 2) A. Hyvärinen and S. M. Smith. Pairwise likelihood ratios for estimation of nonGaussian structural eauation models. Journal of Machine Learning Research 14:111152, 2013. 
__init__
(random_state=None, prior_knowledge=None, apply_prior_knowledge_softly=False, measure='pwling')[source]¶ Construct a DirectLiNGAM model.
Parameters:  random_state (int, optional (default=None)) –
random_state
is the seed used by the random number generator.  prior_knowledge (arraylike, 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.
 measure ({'pwling', 'kernel'}, optional (default='pwling')) – Measure to evaluate independence: ‘pwling’ [2] or ‘kernel’ [1].
 random_state (int, optional (default=None)) –

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: arraylike, shape (n_features, n_features)

bootstrap
(X, n_sampling)¶ Evaluate the statistical reliability of DAG based on the bootstrapping.
Parameters:  X (arraylike, shape (n_samples, n_features)) – Training data, where
n_samples
is the number of samples andn_features
is the number of features.  n_sampling (int) – Number of bootstrapping samples.
Returns: result – Returns the result of bootstrapping.
Return type:  X (arraylike, shape (n_samples, n_features)) – Training data, 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: arraylike, shape (n_features)

estimate_total_effect
(X, from_index, to_index)¶ Estimate total effect using causal model.
Parameters:  X (arraylike, shape (n_samples, n_features)) – Original data, where n_samples is the number of samples and n_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

fit
(X)[source]¶ Fit the model to X.
Parameters: X (arraylike, shape (n_samples, n_features)) – Training data, where n_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)¶ Calculate the pvalue matrix of independence between error variables.
Parameters: X (arraylike, shape (n_samples, n_features)) – Original data, where n_samples is the number of samples and n_features is the number of features. Returns: independence_p_values – pvalue matrix of independence between error variables. Return type: arraylike, shape (n_features, n_features)
