Print causal directions of bootstrap result to stdout.
Parameters:
cdc (dict) – List of causal directions sorted by count in descending order.
This can be set the value returned by BootstrapResult.get_causal_direction_counts() method.
n_sampling (int) – Number of bootstrapping samples.
labels (array-like, optional (default=None)) – List of feature lables.
If set labels, the output feature name will be the specified label.
dagc (dict) – List of directed acyclic graphs sorted by count in descending order.
This can be set the value returned by BootstrapResult.get_directed_acyclic_graph_counts() method.
n_sampling (int) – Number of bootstrapping samples.
labels (array-like, optional (default=None)) – List of feature lables.
If set labels, the output feature name will be the specified label.
exogenous_variables (array-like, shape (index, ...), optional (default=None)) – List of exogenous variables(index).
Prior knowledge is created with the specified variables as exogenous variables.
sink_variables (array-like, shape (index, ...), optional (default=None)) – List of sink variables(index).
Prior knowledge is created with the specified variables as sink variables.
paths (array-like, shape ((index, index), ...), optional (default=None)) – List of variables(index) pairs with directed path.
If (i,j), prior knowledge is created that xi has a directed path to xj.
no_paths (array-like, shape ((index, index), ...), optional (default=None)) – List of variables(index) pairs without directed path.
If (i,j), prior knowledge is created that xi does not have a directed path to xj.
Returns:
prior_knowledge – Return matrix of prior knowledge used for causal discovery.
Directed graph source code in the DOT language with specified adjacency matrix.
Parameters:
adjacency_matrix (array-like with shape (n_features, n_features)) – Adjacency matrix to make graph, where n_features is the number of features.
labels (array-like, optional (default=None)) – Label to use for graph features.
lower_limit (float, optional (default=0.01)) – Threshold for drawing direction.
If float, then directions with absolute values of coefficients less than lower_limit are excluded.
prediction_feature_indices (array-like, optional (default=None)) – Indices to use as prediction features.
prediction_target_label (string, optional (default='Y(pred)'))) – Label to use for target variable of prediction.
prediction_line_color (string, optional (default='red')) – Line color to use for prediction’s graph.
prediction_coefs (array-like, optional (default=None)) – Coefficients to use for prediction’s graph.
prediction_feature_importance (array-like, optional (default=None)) – Feature importance to use for prediction’s graph.
path (tuple, optional (default=None)) – Path to highlight. Tuple of start index and end index.
path_color (string, optional (default=None)) – Colors to highlight a path.
dag (array-like, shape (n_features, n_features)) – The adjacency matrix to fine all paths, where n_features is the number of features.
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.
min_causal_effect (float, optional (default=0.0)) – Threshold for detecting causal direction.
Causal directions with absolute values of causal effects less than min_causal_effect are excluded.
Returns:
paths (array-like, shape (n_paths)) – List of found path, where n_paths is the number of paths.
effects (array-like, shape (n_paths)) – List of causal effect, where n_paths is the number of paths.
X (pandas.DataFrame, shape (n_samples, n_features)) – Training data used to obtain cd_result.
cd_result (array-like with shape (n_features, n_features) or BootstrapResult) – Adjacency matrix or BootstrapResult. These are the results of a causal discovery.
estimator (estimator object) – estimator used for non-linear regression.
Regression with estimator using cause_name and covariates as explanatory
variables and effect_name as objective variable.
Those covariates are searched for in cd_result.
cause_name (str) – The name of the cause variable.
effect_name (str) – The name of the effect variable.
cause_positions (array-like, optional (default=None)) – List of positions from which causal effects are calculated.
By default, cause_positions stores the position at which the value range of X is divided
into 10 equal parts.
percentile (array-like, optional (default=None)) – A tuple consisting of three percentile values. Each value must be greater
than 0 and less than 100. By default, (95, 50, 5) is set.
fig (plt.Figure, optional (default=None)) – If fig is given, draw a figure in fig. If not given, plt.fig
is prepared internally.
boxplot (boolean, optional (default=False)) – If True, draw a box plot instead of a scatter plot for each cause_positions.
evaluate the given adjacency matrix and return fit indices
Parameters:
adjacency_matrix (array-like, shape (n_features, n_features)) – Adjacency matrix representing a causal graph.
The i-th column and row correspond to the i-th column of X.
X (array-like, shape (n_samples, n_features)) – Training data.
is_ordinal (array-like, shape (n_features,)) – Binary list. The i-th element represents that the i-th column of X is ordinal or not.
0 means not ordinal, otherwise ordinal.
Returns:
fit_indices – Fit indices. This API uses semopy’s calc_stats(). See semopy’s reference for details.