Ultralytics YOLO27: Join the waitlist.
License YOLO
Back to Ultralytics Glossary

Causal Discovery

Causal discovery recovers cause-and-effect graphs from data. How the PC algorithm and its successors work, what they assume, and a runnable example.

Causal discovery is the task of inferring which variables cause which from data, producing a directed graph in which an arrow from X to Y means X directly influences Y. Standard machine learning learns associations that are good enough for predictive modeling. Causal discovery asks which of those associations would hold up under an intervention, such as changing a machine setting or a traffic-signal schedule. Its output is a set of candidate causal structures, often with some edges left undirected, that domain experts and experiments then refine.

What Makes Causal Structure Learnable#

Causal graphs are usually directed acyclic graphs (DAGs), the same structure a Bayesian network uses, read causally: each arrow is a direct effect. Discovery algorithms rely on three standard assumptions. Under the causal Markov condition, once a variable's direct causes are known, it is independent of every variable that is not one of its effects. Faithfulness says that every independence in the data comes from the graph structure and not from effects that happen to cancel out. Causal sufficiency says that no unmeasured variable causes two measured ones.

Even with all three assumptions, observational data cannot always reveal edge direction. The chain X → Y → Z, the reversed chain X ← Y ← Z, and the fork X ← Y → Z all imply the same independence pattern, namely that X and Z become independent once Y is known, so no amount of observational data separates them. The collider X → Y ← Z is different. X and Z are independent on their own but become dependent once Y is known, a signature that pins down both arrows.

Algorithms therefore return a Markov equivalence class: a partly directed graph whose oriented edges are certain and whose undirected edges could point either way. The same signature explains a classic source of dataset bias: filtering or adjusting for a collider creates a dependence between its causes that does not exist in the full population.

Discovery Algorithms#

Three families cover most methods. Constraint-based algorithms such as PC, named after Peter Spirtes and Clark Glymour, who published it in 1991, start from a fully connected undirected graph, delete edges between variables that test as conditionally independent, and then orient colliders. FCI extends this approach to settings with hidden confounders. Score-based algorithms such as greedy equivalence search (GES) search over graphs for the best score, for example the Bayesian information criterion, and NOTEARS recasts acyclicity as a smooth constraint so the search can run as continuous optimization with gradient descent. Functional methods such as LiNGAM assume linear relationships with non-Gaussian noise, which makes every edge direction identifiable, even between just two variables.

Discovery libraries also accept time ordering, physical constraints, and expert knowledge as background rules that forbid or require specific edges, which shrinks the search and orients edges the data alone cannot. The open-source causal-learn library implements all three families. This example generates data from a known collider and recovers it with PC:

import numpy as np
from causallearn.search.ConstraintBased.PC import pc

rng = np.random.default_rng(0)
n = 5000

# Ground truth: rain and a stadium event both cause congestion
rain = rng.normal(size=n)
event = rng.normal(size=n)
congestion = rain + event + rng.normal(scale=0.5, size=n)

# PC tests conditional independence to recover the graph from data alone
data = np.column_stack([rain, event, congestion])
result = pc(data, alpha=0.05, node_names=["rain", "event", "congestion"], show_progress=False)
print(result.G)

The output lists two directed edges, rain --> congestion and event --> congestion. PC orients both because rain and event are independent but become dependent once congestion is known. Had the truth been a chain from rain to congestion to delays, the edges would come back undirected.

Where Causal Discovery Is Used#

Biology supplied an early landmark. In 2005, Karen Sachs and colleagues learned a protein-signaling network among 11 proteins and phospholipids from single-cell measurements, recovering most of the known connections, and the authors confirmed a newly predicted link in follow-up lab experiments. In climate science, time-series methods such as PCMCI, developed by Jakob Runge and implemented in the Tigramite package, find causal links among climate variables while handling lags and autocorrelation, a natural fit for time series analysis. The PyWhy ecosystem pairs discovery tools with DoWhy for the next step, estimating how large an effect is once the graph is fixed.

Computer vision can supply the variables. Object counting with Ultralytics YOLO26 tallies the vehicles and pedestrians that cross a line or region in traffic footage, and counts logged per time interval can be joined with weather, event schedules, and signal timing before a discovery algorithm runs.

  • Causal representation learning: Learns the causal variables themselves from raw inputs such as pixels, along with the graph among them. Causal discovery starts from variables that are already measured.
  • Explainable AI (XAI): Explains which inputs drove a model's prediction, without claiming that changing an input would change the outcome in the world.
  • Feature engineering: Selects and builds inputs that improve prediction, including variables that are only correlated with the target. A causal graph identifies the variables whose change would move the target.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Computer vision in sports
Computer vision in sports
Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery
Computer vision for aerial imagery
Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace
Computer vision in aerospace
Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security
Computer vision in security
Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics
Computer vision in robotics
Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics
Computer vision in logistics
Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail
Computer vision in retail
Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare
Computer vision in healthcare
Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing
Computer vision in manufacturing
Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive
Computer vision in automotive
Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture
Computer vision in agriculture
Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Computer vision in sports
Computer vision in sports
Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery
Computer vision for aerial imagery
Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace
Computer vision in aerospace
Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security
Computer vision in security
Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics
Computer vision in robotics
Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics
Computer vision in logistics
Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail
Computer vision in retail
Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare
Computer vision in healthcare
Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing
Computer vision in manufacturing
Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive
Computer vision in automotive
Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture
Computer vision in agriculture
Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning