ETIA.CRV.confidence package

Submodules

ETIA.CRV.confidence.confidence module

is_consistent_edge_L(m1_ij, m1_ji, m2_ij, m2_ji)[source]

Check if two edges are consistent based on their types.

Parameters:
  • m1_ij (int) – Type of edge from node i to node j in the first matrix.

  • m1_ji (int) – Type of edge from node j to node i in the first matrix.

  • m2_ij (int) – Type of edge from node i to node j in the second matrix.

  • m2_ji (int) – Type of edge from node j to node i in the second matrix.

Returns:

True if the edges are consistent, False otherwise.

Return type:

bool

bootstrapping_causal_graph_parallel(input_data, config, tiers, is_cat_var)[source]

Perform bootstrapping of causal graphs in parallel.

Parameters:
  • input_data (numpy.ndarray) – The input data.

  • config (dict) – The configuration for the causal model.

  • tiers (list) – Tiers for variable selection.

  • is_cat_var (list of bool) – Boolean array indicating if the variable is categorical.

Returns:

Bootstrapped samples, matrix graphs, and matrix MEC graphs.

Return type:

list

bootstrapping_causal_graph(n_bootstraps, input_data, tiers, best_config, is_cat_var)[source]

Perform bootstrapping of causal graphs.

Parameters:
  • n_bootstraps (int) – Number of bootstrap repetitions.

  • input_data (numpy.ndarray) – The input data.

  • tiers (list) – Tiers for variable selection.

  • best_config (dict) – The best causal configuration to estimate the bootstrapped graphs.

  • is_cat_var (list of bool) – Boolean array indicating if the variable is categorical.

Returns:

Bootstrapped MEC matrix and bootstrapped graph matrix.

Return type:

list

edge_metrics_on_bootstraps(best_mec_matrix, isPAG, bootstrapped_mec_matrix)[source]

Calculate edge consistency and similarity based on bootstrapped MEC matrices.

Parameters:
  • best_mec_matrix (numpy.ndarray) – The best MEC matrix.

  • isPAG (bool) – True if the matrix is a PAG, False otherwise.

  • bootstrapped_mec_matrix (list of numpy.ndarray) – Bootstrapped MEC matrices.

Returns:

Edge consistency and edge similarity.

Return type:

tuple

calculate_confidence(dataset, opt_conf, n_bootstraps=50)[source]

Calculate edge consistency and similarity confidence.

Parameters:
  • dataset (object) – The dataset.

  • opt_conf (dict) – The optimal configuration.

  • n_bootstraps (int, optional) – Number of bootstrap repetitions. Default is 50.

Returns:

Edge consistency and edge similarity.

Return type:

tuple