SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.10201 · NeurIPS · 2020

On the Role of Sparsity and DAG Constraints for Learning Linear DAGs

Kun Zhang, Ignavier Ng, Amiremad Ghassami

arXiv · PDF · Open in the Atlas

Code that ran

5 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 1 violated it and 4 have no contract verdict; 0 failures of our instrument; 2 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/2006.10201.json · badge: /api/ran/2006.10201.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
ignavier/golem canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
ignavierng/golem marked official in Papers with Code
Papers with Code archive
0 ran · 1 no recorded run
xunzheng/notears extension (classifier label)
classifier basis: classifier_2025
0 ran · 1 no recorded run
FunctionStatusWhere it lives
count_accuracy Ran
ran on a synthesized input
ignavier/golem/src/utils/utils.py
code served (permissive licence) · get_code("a6e9c529933a6c29")
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 dict. 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

# Create a small ground truth binary adjacency matrix (4x4 DAG)
# A DAG has no cycles
B_bin_true = np.array([
    [0, 1, 1, 0],
    [0, 0, 1, 1],
    [0, 0, 0, 1],
    [0, 0, 0, 0]
], dtype=int)

# Create an estimated binary adjacency matrix (4x4)
# This should be a DAG as well
B_bin_est = np.array([
    [0, 1, 0, 0],
    [0, 0, 1, 1],
    [0, 0, 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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
create_dir Ran
ran on a synthesized input
ignavier/golem/src/utils/dir.py
code served (permissive licence) · get_code("dcfefca3872144bb")
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 int, ndim 0, dtype family int, 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 logging
import os
import pathlib
import tempfile

_logger = logging.getLogger(__name__)

def create_dir(output_dir):
    """Create directory.

    Args:
        output_dir (str): A directory to create if not found.

    Returns:
        exit_code: 0 (success) or -1 (failed).
    """
    try:
        if not os.path.exists(output_dir):
            pathlib.Path(output_dir).mkdir(parents=True, exist_ok=True)
        return 0
    except Exception as err:
        _logger.critical('Error when creating directory: {}.'.format(err))
        exit(-1)


# Create a temporary directory path that doesn't exist yet
temp_base = tempfile.gettempdir()
output_dir = os.path.join(temp_base, "test_create_dir_output")

ARGS = {
    "output_dir": output_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, 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
get_init_path Ran
ran on a synthesized input
ignavier/golem/src/utils/utils.py
code served (permissive licence) · get_code("cbfc596e17f36b60")
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 str. 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 os
import tempfile
import shutil
import numpy as np
from datetime import datetime, timedelta

# Create a temporary directory structure for testing
temp_base = tempfile.mkdtemp()
outputs_dir = os.path.join(temp_base, 'output')
os.makedirs(outputs_dir, exist_ok=True)

# Create multiple dated output directories with B_est.npy files
base_time = datetime(2024, 1, 1, 12, 0, 0)
for i in range(3):
    dir_time = base_time + timedelta(hours=i)
    dir_name = dir_time.strftime('%Y%m%d_%H%M%S')
    output_subdir = os.path.join(outputs_dir, dir_name)
    os.makedirs(output_subdir, exist_ok=True)
    
    # Create B_est.npy file
    B_est = np.random.randn(4, 3)
    np.save(os.path.join(output_subdir, 'B_est.npy'), B_est)

ARGS = {
    'outputs_dir': outputs_dir + '/'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
is_dag Ran
ran, violated the contract we drafted
ignavier/golem/src/utils/utils.py
code served (permissive licence) · get_code("e4f1aef57de46e20")
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 numpy as np
import networkx as nx

# Create a small DAG adjacency matrix
# This is a 4x4 binary matrix representing a directed acyclic graph
# 0 -> 1 -> 2
# 0 -> 3
B = np.array([
    [0, 1, 0, 1],
    [0, 0, 1, 0],
    [0, 0, 0, 0],
    [0, 0, 0, 0]
], dtype=np.int32)

ARGS = {
    "B": B
}
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 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
load_yaml_config Ran
ran on a synthesized input
ignavier/golem/src/utils/config.py
code served (permissive licence) · get_code("1a2bc2ff671b050e")
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 dict. 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 yaml
import tempfile
import os

# Create a temporary YAML file with valid content
temp_dir = tempfile.mkdtemp()
config_path = os.path.join(temp_dir, "test_config.yaml")

config_content = """
model:
  name: test_model
  layers: 3
  hidden_dim: 128
training:
  batch_size: 32
  learning_rate: 0.001
  epochs: 10
data:
  train_split: 0.8
  val_split: 0.1
"""

with open(config_path, 'w') as f:
    f.write(config_content)

ARGS = {
    'path': config_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
GolemModel Not yet run
unverified (harvested, no recorded run)
ignavierng/golem/src/models/golem_model.py
code served (permissive licence) · get_code("c81d49045d06ca2f")
How it ran

no invocation recorded.

notears_linear Not yet run
unverified (harvested, no recorded run)
xunzheng/notears/notears/linear.py
code served (permissive licence) · get_code("8121d0e3bc3faff7")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

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, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 2 later) and 5 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
2 dated earlier, 6 later
1803.01422 (2018-03)
DAGs with NO TEARS: Continuous Optimization for Structure Learning
1909.13189 (2019-09)
Learning Sparse Nonparametric DAGs
2007.09445 (2020-07)
Structure Mapping for Transferability of Causal Models
and 5 more not named here
is_dag 1 other paper
1 later
2410.23862 (2024-10)
$ψ$DAG: Projected Stochastic Approximation Iteration for DAG Structure Learning

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

Learning graphical structures based on Directed Acyclic Graphs (DAGs) is a challenging problem, partly owing to the large search space of possible graphs. A recent line of work formulates the structure learning problem as a continuous constrained optimization task using the least squares objective and an algebraic characterization of DAGs. However, the formulation requires a hard DAG constraint and may lead to optimization difficulties. In this paper, we study the asymptotic role of the sparsity and DAG constraints for learning DAG models in the linear Gaussian and non-Gaussian cases, and investigate their usefulness in the finite sample regime. Based on the theoretical results, we formulate a likelihood-based score function, and show that one only has to apply soft sparsity and DAG constraints to learn a DAG equivalent to the ground truth DAG. This leads to an unconstrained optimization problem that is much easier to solve. Using gradient-based optimization and GPU acceleration, our procedure can easily handle thousands of nodes while retaining a high accuracy. Extensive experiments validate the effectiveness of our proposed method and show that the DAG-penalized likelihood objective is indeed favorable over the least squares one with the hard DAG constraint.

For agents

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

get_harvested_code_for_paper("2006.10201")
get_code_for_paper("2006.10201")
have("2006.10201")

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

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

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

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

Connect an agent — have() is free.