SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2209.08037 · NeurIPS · 2022

DAGMA: Learning DAGs via M-matrices and a Log-Determinant Acyclicity Characterization

Pradeep Ravikumar, Bryon Aragam, Kevin Bello

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2209.08037.json · badge: /api/ran/2209.08037.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
kevinsbello/dagma canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
samiatto/colide community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
gabriele-dominici/causalcgm community
Papers with Code archive
1 ran · 0 no recorded run
isvy08/otm community
Papers with Code archive
1 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
0 ran · 1 no recorded run
FunctionStatusWhere it lives
DagmaCE Ran
ran on a synthesized input · constructed an object; no result was computed
gabriele-dominici/causalcgm/causalcgm/dagma.py
code served (permissive licence) · get_code("3c5e1fbf2afb9f18")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, DagmaCE: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
import torch.nn as nn
import typing

torch.manual_seed(0)

# Set up arguments for DagmaCE.__init__
n_concepts = 4
n_classes = 3
dims = [7, 5, 3]  # dims for hidden layers in MLPs
bias = False
gamma = 10.0
no_out_task = True

ARGS = {
    "n_concepts": n_concepts,
    "n_classes": n_classes,
    "dims": dims,
    "bias": bias,
    "gamma": gamma,
    "no_out_task": no_out_task,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DagmaCE — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DagmaCE output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
DagmaNonlinear Ran
ran on a synthesized input · constructed an object; no result was computed
isvy08/otm/dagma.py
pointer only (licence: NONE) · get_code("0e741fd1baab2124")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, isvy08/otm when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

DagmaNonlinear Ran
ran on a synthesized input · constructed an object; no result was computed
kevinsbello/dagma/src/dagma/nonlinear.py
code served (permissive licence) · get_code("ae4b8f64300ff183")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, DagmaNonlinear: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

class SimpleModel(nn.Module):
    """
    A minimal neural network model that satisfies the interface expected by DagmaNonlinear.
    """
    def __init__(self, d: int = 4):
        super().__init__()
        self.d = d
        # fc1 is used for L1 regularization
        self.fc1 = nn.Linear(d, d)
        self.fc2 = nn.Linear(d, d)
        
    def forward(self, X: torch.Tensor) -> torch.Tensor:
        """
        Forward pass that takes input and returns output of same shape.
        """
        out = torch.relu(self.fc1(X))
        out = self.fc2(out)
        return out
    
    def h_func(self, s: float) -> torch.Tensor:
        """
        Computes the h function (acyclicity constraint).
        Returns a scalar tensor.
        """
        # Simple stand-in: sum of squared weights as a proxy for h
        h = torch.tensor(0.0, dtype=torch.double)
        for param in self.parameters():
            h = h + torch.sum(param ** 2)
        return h * s
    
    def fc1_l1_reg(self) -> torch.Tensor:
        """
        Computes L1 regularization on fc1 weights.
        Returns a scalar tensor.
        """
        return torch.sum(torch.abs(self.fc1.weight))

# Create a small synthetic dataset
X = torch.randn(2, 4, dtype=torch.double)

# Create the model
model = SimpleModel(d=4)
model = model.double()

# Define arguments for DagmaNonlinear.__init__
ARGS = {
    "model": model,
    "verbose": False,
    "dtype": torch.double,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DagmaNonlinear — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DagmaNonlinear output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
count_accuracy Ran
ran on a synthesized input
samiatto/colide/utils.py
code served (permissive licence) · get_code("614ebb7febab6a64")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create small binary adjacency matrices for testing
# B_bin_true: ground truth DAG (directed acyclic graph)
d = 4
B_bin_true = np.array([
    [0, 1, 1, 0],
    [0, 0, 0, 1],
    [0, 0, 0, 1],
    [0, 0, 0, 0]
], dtype=int)

# B_bin_est: estimated binary matrix with values in {0, 1, -1}
# -1 indicates undirected edges in CPDAG
B_bin_est = np.array([
    [0, 1, 1, 0],
    [0, 0, -1, 1],
    [0, -1, 0, 1],
    [0, 0, 0, 0]
], dtype=int)

ARGS = {
    "B_bin_true": B_bin_true,
    "B_bin_est": B_bin_est,
    "check_input": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_dag Ran
ran on a synthesized input
samiatto/colide/utils.py
code served (permissive licence) · get_code("935903491a9e59b4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
import networkx as nx

# The function is_dag takes a parameter W and creates a DiGraph from it,
# then checks if it's a directed acyclic graph.
# nx.DiGraph() can accept an adjacency matrix (2D array-like structure)

# Create a small adjacency matrix representing a DAG
# A directed acyclic graph has no cycles
# Example: edges 0->1, 0->2, 1->2 form a valid DAG

# Using numpy array as adjacency matrix
W = np.array([
    [0, 1, 1],
    [0, 0, 1],
    [0, 0, 0]
], dtype=int)

ARGS = {
    "W": W
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
simulate_sem Ran
ran on a synthesized input
samiatto/colide/utils.py
code served (permissive licence) · get_code("48a22750a891be8c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import networkx as nx

ARGS = {
    'n_nodes': 5,
    'n_samples': 10,
    'edges': 6,
    'graph_type': 'er',
    'edge_type': 'weighted',
    'var_type': 'ev',
    'noise': 'normal',
    'var': 1.0,
    'w_range': ((-2.0, -0.5), (0.5, 2.0)),
    'seed': 123
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
notears_linear Not yet run
unverified (harvested, no recorded run)
this paper's copy was not recorded; identical code first harvested from xunzheng/notears
pointer only · get_code("8121d0e3bc3faff7")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 6 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
notears_linear 8 other papers
4 dated earlier, 4 later
1803.01422 (2018-03)
DAGs with NO TEARS: Continuous Optimization for Structure Learning
1909.13189 (2019-09)
Learning Sparse Nonparametric DAGs
2006.10201 (2020-06)
On the Role of Sparsity and DAG Constraints for Learning Linear DAGs
and 5 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The combinatorial problem of learning directed acyclic graphs (DAGs) from data was recently framed as a purely continuous optimization problem by leveraging a differentiable acyclicity characterization of DAGs based on the trace of a matrix exponential function. Existing acyclicity characterizations are based on the idea that powers of an adjacency matrix contain information about walks and cycles. In this work, we propose a new acyclicity characterization based on the log-determinant (log-det) function, which leverages the nilpotency property of DAGs. To deal with the inherent asymmetries of a DAG, we relate the domain of our log-det characterization to the set of M-matrices, which is a key difference to the classical log-det function defined over the cone of positive definite matrices. Similar to acyclicity functions previously proposed, our characterization is also exact and differentiable. However, when compared to existing characterizations, our log-det function: (1) Is better at detecting large cycles; (2) Has better-behaved gradients; and (3) Its runtime is in practice about an order of magnitude faster. From the optimization side, we drop the typically used augmented Lagrangian scheme and propose DAGMA (Directed Acyclic Graphs via M-matrices for Acyclicity), a method that resembles the central path for barrier methods. Each point in the central path of DAGMA is a solution to an unconstrained problem regularized by our log-det function, then we show that at the limit of the central path the solution is guaranteed to be a DAG. Finally, we provide extensive experiments for linear and nonlinear SEMs and show that our approach can reach large speedups and smaller structural Hamming distances against state-of-the-art methods. Code implementing the proposed method is open-source and publicly available at https://github.com/kevinsbello/dagma.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2209.08037")
get_code_for_paper("2209.08037")
have("2209.08037")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2209.08037.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2209.08037.svg)](https://syntology.ai/paper/2209.08037)

Connect an agent — have() is free.