MultiGroupRESIT

class lingam.MultiGroupRESIT(regressor, random_state=None, prior_knowledge=None, alpha=0.01)[source]

Implementation of RESIT(regression with subsequent independence test) Algorithm [1] with multiple groups

References

Notes

RESIT algorithm returns an adjacency matrix consisting of zeros or ones, rather than an adjacency matrix consisting of causal coefficients, in order to estimate nonlinear causality.

__init__(regressor, random_state=None, prior_knowledge=None, alpha=0.01)[source]

Construct a RESIT model.

Parameters:
  • regressor (regressor object implementing 'fit' and 'predict' function (default=None)) – Regressor to compute residuals. This regressor object must have fit method and predict function like scikit-learn’s model.

  • 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.

  • alpha (float, optional (default=0.01)) – Alpha level for HSIC independence test when removing superfluous edges.

property 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, …)

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), where n_samples is the number of samples and n_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, …)

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)

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_effectBecause RESIT is a nonlinear algorithm, it cannot estimate the total effect and always returns a value of zero

Return type:

float

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), where n_samples is the number of samples and n_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_valuesRESIT always returns a zero matrix

Return type:

array-like, shape (n_features, n_features)