ABICLiNGAM
- class lingam.ABICLiNGAM(beta=1.0, lam=0.05, acyc_order=None, seed=0, max_outer=100, tol_h=1e-08, min_causal_effect=0.05, min_error_covariance=0.05, rho_max=1e+16, inner_start=1, inner_growth=1, inner_tol=0.0001)[source]
Implementation of ABIC-LiNGAM Algorithm. [1] Original code: https://github.com/Yoshimitsu-try/ABIC_LiNGAM
References
- __init__(beta=1.0, lam=0.05, acyc_order=None, seed=0, max_outer=100, tol_h=1e-08, min_causal_effect=0.05, min_error_covariance=0.05, rho_max=1e+16, inner_start=1, inner_growth=1, inner_tol=0.0001)[source]
Construct a ABICLiNGAM model.
- Parameters:
beta (float, optional (default=1.0)) – Power in residual loss, i.e., ||r||^(2*beta)
lam (float, optional (default=0.05)) – The weight of the regularization term.
acyc_order (int or None, optional (default=None)) – Order of the truncated series for acyclicity penalty. If None, defaults to the number of variables.
min_causal_effect (float, optional (default=0.05)) – Threshold for detecting causal edge. Causal edges with absolute values of causal effects less than
min_causal_effectare excluded.min_error_covariance (float, optional (default=0.05)) – Threshold for detecting error covariances. Error covariances with absolute values less than
min_error_covarianceare excluded.seed (int, optional (default=0)) – Seed for the random number generator.
max_outer (int, optional (default=100)) – Maximum number of outer iterations.
tol_h (float, optional (default=1e-8)) – Tolerance for acyclicity penalty to stop.
rho_max (float, optional (default=1e16)) – Maximum value for Augmented Lagrangian penalty parameter rho.
inner_start (int, optional (default=1)) – Initial number of inner refinement steps.
inner_growth (int, optional (default=1)) – Growth of inner refinement steps per outer iteration.
inner_tol (float, optional (default=1e-4)) – Tolerance for inner loop convergence.
- property 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, n_sampling=100)[source]
Bootstrap sampling to assess variability of estimates.
- Parameters:
X (array-like, shape (n_samples, n_features)) – Observed data matrix.
n_sampling (int, optional (default=100)) – Number of bootstrap samples.
- Returns:
Bs (array-like, shape (n_sampling, n_features, n_features)) – Bootstrap samples of estimated adjacency matrices.
Omegas (array-like, shape (n_sampling, n_features, n_features)) – Bootstrap samples of estimated error covariance matrices.
- property 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)
- property coefficient_matrix_
Estimated coefficient matrix.
- Returns:
coefficient_matrix_ – The coefficient matrix B of fitted model, where n_features is the number of features.
- Return type:
array-like, shape (n_features, n_features)
- property error_covariance_matrix_
Estimated error covariance matrix.
- Returns:
error_covariance_matrix_ – The error covariance matrix Omega of fitted model, where n_features is the number of features.
- Return type:
array-like, shape (n_features, n_features)
- estimate_total_effect(X, from_index, to_index)[source]
Estimate total effect using causal model.
- 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.
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 (array-like, shape (n_samples, n_features)) – Observed data matrix.
- Returns:
self – Returns the instance itself.
- Return type:
object
- get_error_independence_p_values(X)
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)