explaingit

dmirlab-group/cdfm

Analysis updated 2026-05-18

53PythonAudience · researcherComplexity · 3/5LicenseSetup · easy

TLDR

A pretrained Python model that predicts cause-and-effect graphs from raw observational data in a single pass, without retraining per dataset.

Mindmap

mindmap
  root((CDFM))
    What it does
      Predicts causal graphs
      Zero shot inference
      Fills missing values
    Tech stack
      Python
      PyTorch
      Hugging Face
    Use cases
      Causal discovery research
      Missing data imputation
      Benchmarking methods
    Audience
      Researchers
      Data scientists
    Setup
      pip install
      Load pretrained model
      Call predict

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Predict a causal graph from a table of observational data without designing a custom model

USE CASE 2

Fill in missing values in a dataset using the model's built-in imputation feature

USE CASE 3

Benchmark a new causal discovery method against a state-of-the-art pretrained baseline

USE CASE 4

Reproduce or build on the CDFM results reported in the associated arXiv paper

What is it built with?

PythonPyTorchHugging Face HubNumPy

How does it compare?

dmirlab-group/cdfmfudancvl/sam-mtkizuna-intelligence/irodori-tts-lite
Stars535353
LanguagePythonPythonPython
Setup difficultyeasyhardhard
Complexity3/54/54/5
Audienceresearcherresearcherresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires PyTorch 2.0 or newer and downloads a pretrained checkpoint from Hugging Face.

Apache 2.0: free to use, modify, and distribute, including commercially, as long as you keep the license and copyright notices.

In plain English

CDFM, short for Causal Discovery Foundation Model, is a pretrained machine learning model that tries to figure out cause and effect relationships hidden in a dataset. Given a table of numbers with no labels telling you what causes what, the model looks at the raw data and predicts a causal graph, meaning a diagram of which variables in the data appear to influence which other variables, in a single pass rather than through a lengthy statistical search. The README explains that CDFM was trained on a large and varied collection of synthetic datasets built from artificial cause and effect structures, and that this training lets it recognize the kinds of statistical patterns that show up when one variable causes another. Because of that training, it works in what the paper calls a zero-shot setting: the same pretrained model can be applied to a new dataset, of a different size and number of variables, without retraining it first. The README states it outperforms other methods it was compared against across 15 different types of underlying data generating processes and on real-world benchmark datasets. Using the model is meant to be simple. It is installed with a single pip command, and Python code loads it from Hugging Face Hub with one line and produces a prediction with another, calling model.predict on your data to get back a causal graph as a grid of zeros and ones. The library also includes a separate feature for filling in missing values in a dataset, which the README shows performing noticeably better than a simple average based fill-in method on an example dataset. The project is research code released alongside an academic paper on arXiv, and it targets people doing causal inference or structural learning research in Python, such as academics or data scientists who need to estimate causal structure from observational data without hand designing a model for each new dataset. It is released under the Apache 2.0 license.

Copy-paste prompts

Prompt 1
Help me install cdfm-base with pip and run CDFM on a sample CSV dataset
Prompt 2
Explain what a causal graph is and how model.predict's output adjacency matrix represents it
Prompt 3
Show me how to use CDFM's imputation feature to fill missing values and compare it to mean imputation
Prompt 4
Walk me through the CDFM class API, including the threshold and standardize parameters

Frequently asked questions

What is cdfm?

A pretrained Python model that predicts cause-and-effect graphs from raw observational data in a single pass, without retraining per dataset.

What language is cdfm written in?

Mainly Python. The stack also includes Python, PyTorch, Hugging Face Hub.

What license does cdfm use?

Apache 2.0: free to use, modify, and distribute, including commercially, as long as you keep the license and copyright notices.

How hard is cdfm to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is cdfm for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.