# FCI

## Algorithm Introduction

Causal Discovery with Fast Causal Inference (FCI [1]).

## Usage

```
from causallearn.search.ConstraintBased.FCI import fci
# default parameters
G, edges = fci(data)
# or customized parameters
G, edges = fci(data, independence_test_method, alpha, depth, max_path_length,
verbose, background_knowledge, cache_variables_map)
# visualization
from causallearn.utils.GraphUtils import GraphUtils
pdy = GraphUtils.to_pydot(G)
pdy.write_png('simple_test.png')
```

Visualization using pydot is recommended. If specific label names are needed, please refer to this usage example.

## Parameters

**dataset**: numpy.ndarray, shape (n_samples, n_features). Data, where n_samples is the number of samples
and n_features is the number of features.

**independence_test_method**: Independence test method function. Default: ‘fisherz’.“fisherz”: Fisher’s Z conditional independence test.

“chisq”: Chi-squared conditional independence test.

“gsq”: G-squared conditional independence test.

“kci”: kernel-based conditional independence test. (As a kernel method, its complexity is cubic in the sample size, so it might be slow if the same size is not small.)

“mv_fisherz”: Missing-value Fisher’s Z conditional independence test.

**alpha**: Significance level of individual partial correlation tests. Default: 0.05.

**depth**: The depth for the fast adjacency search, or -1 if unlimited. Default: -1.

**max_path_length**: the maximum length of any discriminating path, or -1 if unlimited. Default: -1.

**verbose**: True is verbose output should be printed or logged. Default: False.

**background_knowledge**: class BackgroundKnowledge. Add prior edges according to assigned causal connections. Default: None.
For detailed usage, please kindly refer to its usage example.

**cache_variables_map**: This variable a map which contains the variables relate with cache. If it is not None, it should contain ‘data_hash_key’ 、’ci_test_hash_key’ and ‘cardinalities’. Default: None.

## Returns

**G**: a CausalGraph object, where G is a PAG and the illustration of its end nodes is as follows:

**edges**: list. Contains graph’s edges properties.If edge.properties have the Property ‘nl’, then there is no latent confounder. Otherwise, there are possibly latent confounders.

If edge.properties have the Property ‘dd’, then it is definitely direct. Otherwise, it is possibly direct.

If edge.properties have the Property ‘pl’, then there are possibly latent confounders. Otherwise, there is no latent confounder.

If edge.properties have the Property ‘pd’, then it is possibly direct. Otherwise, it is definitely direct.