Abstract
Traditional structure learning for Directed Acyclic Graphs (DAGs) typically assumes a single, fixed graph represents the dependencies for every individual in a dataset. However, in many real-world scenarios, relationships between variables are heterogeneous and depend on individual context. This paper introduces Contextual Directed Acyclic Graphs, a novel framework for learning graph structures that vary across individuals based on their unique "contextual" features. By integrating a neural network with a specialized projection layer, the model predicts personalized, sparse, and acyclic graphs, allowing for dynamic topological orderings that shift with context.
Introduction
In fields ranging from drug consumption patterns to economic behaviors, the relationships between variables often exhibit significant heterogeneity. For instance, the influence of one substance on another might depend heavily on an individual's personality traits. Traditional DAG learning methods struggle with this heterogeneity, often assuming a fixed topological ordering or failing to capture how the presence and direction of edges can change based on context. The combinatorial explosion of possible graph structures makes learning personalized, acyclic graphs computationally daunting.
Methods
The authors propose a neural network architecture that maps contextual features ($z$) to a weighted adjacency matrix ($W(z)$). The core of this architecture is a specialized Projection Layer that transforms dense neural network outputs into sparse DAGs.
Neural Architecture and Projection
Standard hidden layers capture non-linear effects of the context, outputting a dense directed graph. The projection layer then leverages a continuous characterization of acyclicity (the log-determinant based "DAGMA" framework) and applies an $\ell_1$ ball constraint to ensure the resulting graph is parsimonious. To maintain efficiency within a deep learning pipeline, the authors derived an analytical gradient for this layer, allowing for backpropagation without differentiating through iterative optimization.
Key Insights
- Dynamic Topology: Unlike previous methods, Contextual DAGs allow the topological order to change with context. An edge might point from $A \rightarrow B$ for one person and $B \rightarrow A$ for another, or disappear entirely.
- Personalized Dependencies: The model demonstrates that "fixed" graphs are often just a poor average of many distinct individual structures. Conditioning on context allows for the recovery of more accurate and meaningful relationships.
- Continuous Reformulation: By turning the discrete, combinatorial problem of graph search into a continuous optimization problem via the projection layer, personalized graph learning becomes practical for modern machine learning workflows.
Experimental Results
The approach was evaluated on both synthetic benchmarks and a real-world drug consumption dataset containing records for 1,885 participants.
- Superior Recovery: In synthetic experiments, Contextual DAGs were the only method capable of accurately recovering true context-specific graphs as sample sizes increased, significantly outperforming fixed-graph baselines.
- Personalized Risk Profiles: On the drug consumption dataset, the model revealed that individuals with high neuroticism and sensation-seeking scores exhibit more complex, interconnected drug use patterns. This suggests that "gateway" drug effects are not universal but vary by personality profile.
- Computational Efficiency: Training time scales linearly with the sample size ($n$) and roughly cubically with the number of nodes ($p$), which is standard for state-of-the-art continuous DAG learning methods.
Limitations and Future Work
While the framework advances personalized structure learning, several areas for future research remain. The authors focus on the learning problem rather than causal interpretation; moving toward true contextual causal discovery would require additional assumptions like causal sufficiency. Additionally, while $O(p^3)$ scaling is efficient for many tasks, it remains a bottleneck for extremely large graphs (e.g., genomics). Finally, the current model assumes a linear relationship between the nodes themselves, even though the mapping from context to those relationships is non-linear.
Summary updated