RCD¶
-
class
lingam.
RCD
(max_explanatory_num=2, cor_alpha=0.01, ind_alpha=0.01, shapiro_alpha=0.01, MLHSICR=False, bw_method='mdbs')[source]¶ Implementation of RCD Algorithm [1]
References
[1] T.N.Maeda and S.Shimizu. RCD: Repetitive causal discovery of linear non-Gaussian acyclic models with latent confounders. In Proc. 23rd International Conference on Artificial Intelligence and Statistics (AISTATS2020), Palermo, Sicily, Italy. PMLR 108:735-745, 2020. -
__init__
(max_explanatory_num=2, cor_alpha=0.01, ind_alpha=0.01, shapiro_alpha=0.01, MLHSICR=False, bw_method='mdbs')[source]¶ Construct a RCD model.
Parameters: - max_explanatory_num (int, optional (default=2)) – Maximum number of explanatory variables.
- cor_alpha (float, optional (default=0.01)) – Alpha level for pearson correlation.
- ind_alpha (float, optional (default=0.01)) – Alpha level for HSIC.
- shapiro_alpha (float, optional (default=0.01)) – Alpha level for Shapiro-Wilk test.
- MLHSICR (bool, optional (default=False)) – If True, use MLHSICR for multiple regression, if False, use OLS for multiple regression.
- bw_method (str, optional (default=``mdbs``)) –
The method used to calculate the bandwidth of the HSIC.
mdbs
: Median distance between samples.scott
: Scott’s Rule of Thumb.silverman
: Silverman’s Rule of Thumb.
-
adjacency_matrix_
¶ Estimated adjacency matrix.
Returns: adjacency_matrix_ – The adjacency matrix B of fitted model, where n_features is the number of features. Set np.nan if order is unknown. Return type: array-like, shape (n_features, n_features)
-
ancestors_list_
¶ Estimated ancestors list.
Returns: ancestors_list_ – The list of causal ancestors sets, where n_features is the number of features. Return type: array-like, shape (n_features)
-
bootstrap
(X, n_sampling)[source]¶ Evaluate the statistical reliability of DAG based on the bootstrapping.
Parameters: - X (array-like, 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 (array-like, shape (n_samples, n_features)) – Training data, where
-
fit
(X)[source]¶ Fit the model to X.
Parameters: X (array-like, 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)[source]¶ Calculate the p-value matrix of independence between error variables.
Parameters: X (array-like, 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 – p-value matrix of independence between error variables. Return type: array-like, shape (n_features, n_features)
-