VARMABootstrapResult

class lingam.VARMABootstrapResult(adjacency_matrices, total_effects, order)[source]

The result of bootstrapping for Time series algorithm.

__init__(adjacency_matrices, total_effects, order)[source]

Construct a BootstrapResult.

Parameters:
  • adjacency_matrices (array-like, shape (n_sampling)) – The adjacency matrix list by bootstrapping.

  • total_effects (array-like, shape (n_sampling)) – The total effects list by bootstrapping.

property adjacency_matrices_

The adjacency matrix list by bootstrapping.

Returns:

adjacency_matrices_ – The adjacency matrix list, where n_sampling is the number of bootstrap sampling.

Return type:

array-like, shape (n_sampling)

get_causal_direction_counts(n_directions=None, min_causal_effect=None, split_by_causal_effect_sign=False)

Get causal direction count as a result of bootstrapping.

Parameters:
  • n_directions (int, optional (default=None)) – If int, then The top n_directions items are included in the result

  • min_causal_effect (float, optional (default=None)) – Threshold for detecting causal direction. If float, then causal directions with absolute values of causal effects less than min_causal_effect are excluded.

  • split_by_causal_effect_sign (boolean, optional (default=False)) – If True, then causal directions are split depending on the sign of the causal effect.

Returns:

causal_direction_counts – List of causal directions sorted by count in descending order. The dictionary has the following format:

{'from': [n_directions], 'to': [n_directions], 'count': [n_directions]}

where n_directions is the number of causal directions.

Return type:

dict

get_directed_acyclic_graph_counts(n_dags=None, min_causal_effect=None, split_by_causal_effect_sign=False)

Get DAGs count as a result of bootstrapping.

Parameters:
  • n_dags (int, optional (default=None)) – If int, then The top n_dags items are included in the result

  • min_causal_effect (float, optional (default=None)) – Threshold for detecting causal direction. If float, then causal directions with absolute values of causal effects less than min_causal_effect are excluded.

  • split_by_causal_effect_sign (boolean, optional (default=False)) – If True, then causal directions are split depending on the sign of the causal effect.

Returns:

directed_acyclic_graph_counts – List of directed acyclic graphs sorted by count in descending order. The dictionary has the following format:

{'dag': [n_dags], 'count': [n_dags]}.

where n_dags is the number of directed acyclic graphs.

Return type:

dict

get_paths(from_index, to_index, from_lag=0, to_lag=0, min_causal_effect=None)[source]

Get all paths from the start variable to the end variable and their bootstrap probabilities.

Parameters:
  • from_index (int) – Index of the variable at the start of the path.

  • to_index (int) – Index of the variable at the end of the path.

  • from_lag (int) – Number of lag at the start of the path. from_lag should be greater than or equal to to_lag.

  • to_lag (int) – Number of lag at the end of the path. from_lag should be greater than or equal to to_lag.

  • min_causal_effect (float, optional (default=None)) – Threshold for detecting causal direction. Causal directions with absolute values of causal effects less than min_causal_effect are excluded.

Returns:

paths – List of path and bootstrap probability. The dictionary has the following format:

{'path': [n_paths], 'effect': [n_paths], 'probability': [n_paths]}

where n_paths is the number of paths.

Return type:

dict

get_probabilities(min_causal_effect=None)

Get bootstrap probability.

Parameters:

min_causal_effect (float, optional (default=None)) – Threshold for detecting causal direction. If float, then causal directions with absolute values of causal effects less than min_causal_effect are excluded.

Returns:

probabilities – List of bootstrap probability matrix.

Return type:

array-like

get_total_causal_effects(min_causal_effect=None)

Get total effects list.

Parameters:

min_causal_effect (float, optional (default=None)) – Threshold for detecting causal direction. If float, then causal directions with absolute values of causal effects less than min_causal_effect are excluded.

Returns:

total_causal_effects – List of bootstrap total causal effect sorted by probability in descending order. The dictionary has the following format:

{'from': [n_directions], 'to': [n_directions], 'effect': [n_directions], 'probability': [n_directions]}

where n_directions is the number of causal directions.

Return type:

dict

property resampled_indices_

The list of original index of resampled samples.

Returns:

resampled_indices_ – The list of original index of resampled samples, where n_sampling is the number of bootstrap sampling and resample_size is the size of each subsample set.

Return type:

array-like, shape (n_sampling, resample_size)

property total_effects_

The total effect list by bootstrapping.

Returns:

total_effects_ – The total effect list, where n_sampling is the number of bootstrap sampling.

Return type:

array-like, shape (n_sampling)