> For the complete documentation index, see [llms.txt](https://docs.rootcause.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rootcause.ai/core-technologies/causal-discovery.md).

# Causal Discovery

Causal Discovery finds the inbound causes and outbound effects behind core concepts across your data. It builds a causal graph from unified Datasets generated by the ontology, combining domain rules with statistical evidence. The result is a fully directed acyclic graph (DAG). This graph is then explored, adjusted, and validated before serving as the foundation for simulations in the Digital Twin.

Put simply, RootCause automatically builds a chart of what things impact others. This is the basis for running detailed and fully explainable simulations.

To begin, open **Digital Twins**, click **New Digital Twin**, keep the default **Discover from data** method, pick your dataset in the **Choose your data** step, and run **Discover & train** — discovery runs as part of building the twin. The twin can be built from an ontology-generated dataset or directly from a data source. See [Causal Graph](https://docs.rootcause.ai/user-guide/causal-graph.md).

***

#### Definition & Purpose

Causal Discovery goes beyond correlation. It identifies which factors truly cause outcomes to change, helping you:

* Prioritize interventions on drivers that move the needle
* Filter out noise and redundant relationships
* Keep results explainable and auditable for business and technical users

***

#### How Causal Discovery Works

The default discovery pipeline is a staged filtering cascade:

1. Screening – A cascade of fast statistical filters (distance correlation and partial distance correlation, executed in a native C++ kernel) eliminates variable pairs with no meaningful dependence, so expensive tests only run on plausible candidates. Domain rules like "time moves forward" constrain the search from the start.
2. Independence testing – Surviving pairs go through kernel conditional-independence tests to prune links that are explained away by other variables.
3. Edge classification – A machine-learning classifier scores the remaining candidate edges, confirming the skeleton and proposing directions from the statistical evidence.
4. Direction resolution – Each surviving candidate edge is given a direction. The discovery trace records each variable pair's direction provenance — `llm`, `ml`, `forced`, `constraint`, or `compelled` — so you can always see why an edge points the way it does.
5. DAG assembly – User constraints (known and blocked edges), temporal ordering, and the accumulated evidence are combined into an acyclic graph. Each edge is added in its preferred direction; if that direction would close a cycle it is reversed and recorded as `compelled`, and if neither direction is acyclic the edge is dropped. The output is always a fully directed acyclic graph.

Two versions of this cascade can be selected: SPARC and SPARC-fast, which is the default. For time-series data, the pipeline can optionally discover lag structure between variables: that stage is experimental and off by default. Separately, an equation-discovery stage — on by default for every twin type — fits an interpretable symbolic equation for each node that has parents, from those parents.

***

#### Editing & Oversight

Causal graphs aren't static. RootCause provides controls to incorporate domain knowledge:

* Edit assumptions: Add dependencies or break them to test scenarios
* Known relationships: Declare edges that must exist
* Blocked relationships: Forbid edges that should never exist

Edits are saved as a new version of the model, preserving the original as history. When you are satisfied with the graph, retrain the model to apply the changes — this ensures the causal model reflects both statistical evidence and expert judgment. See [Causal Graph](https://docs.rootcause.ai/user-guide/causal-graph.md) for how to explore and edit the graph in the UI.

***

#### Outputs & Views

When discovery is complete, the causal graph can be explored and evaluated:

**Explore**

* Flow Chart or DAG View for interactive navigation
* Path Analysis: Sankey diagrams showing incoming and outgoing causal paths with contribution weights
* Model Probabilities: Learned distributions or parameters for each node

**Evaluate**

* Graph- and node-level metrics
* Categorical targets: Accuracy, AUC
* Numeric targets: MSE, MAE, R², log-likelihood
* Highlights strong and weak areas to guide refinement (e.g. adding priors, blocking edges)
