Skip to main content

graph_simulator

Fast library to simulate data from directed acyclic graphs (DAGs).

Dependencies between vertices in the graph are specified in a human-readable YAML file. For example, the simple graph \( X \rightarrow Y \) is specified by the YAML code below:

X:
  kernel:
    type: "uniform"
    sample_domain: [0, 1]
    terms: null
  dependencies: null

Y:
  kernel:
    type: "linear"
    sample_domain: [1, 1.5]
    noise: 0.1
    terms:
      - intercept: 1
        indicators: null
        value: 0.5
        variable:
          1: "X"
  dependencies:
    1: ["X"]

Here, X does not have any parents, as specified by dependencies: null, and it is uniformly distributed with support \( {0, 1} \). In contrast, \( Y_t \) has a parent \( X_{t-1} \) (graphically we write \( X_{t-1} \rightarrow Y_t \)), which is specified by 1: ["X"] under dependencies — interpreted as “X of lag 1”.

In the kernel section, we see that Y depends on its parents linearly (type: "linear"), but takes a random value with probability 0.1 in \( {1, 1.5} \), as indicated by noise: 0.1 and sample_domain: [1, 1.5].

The linear dependency is specified in the terms subsection. In this case, there is a single term composed of an intercept of value 1 (intercept: 1) plus a value of 0.5 (value: 0.5) times the value of “X at lag 1” (1: "X" under variable). Terms may, in addition, depend on indicator functions that can render the whole term zero.

Thus, in the above example, we may write the functional form of \( Y_t \) as:

Y_t =
\begin{cases}
  1 + 0.5 \cdot X_{t-1}, & \text{with probability } 0.9 \\\\
  \text{Unif}(\{1, 1.5\}), & \text{with probability } 0.1
\end{cases}

Supported kernels:

  • uniform
  • linear
  • poisson
  • binomial
  • mixed
  • constant

Metadata

Release files for graph-simulator 0.2.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graph-simulator 0.2.9
File Size Uploaded
graph_simulator-0.2.9.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for graph-simulator 0.2.9
File Interpreter ABI Platform
graph_simulator-0.2.9-cp312-cp312-macosx_15_0_arm64.whl CPython 3.12 CPython 3.12 macOS 15.0+ ARM64 Details

Total release size: 120.3 kB

Release files / graph_simulator-0.2.9.tar.gz

Download URL graph_simulator-0.2.9.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ae0007632b5020a8a0683b4f43da0737296de75d4ae6f3f1b6702c49fe842d96
BLAKE2b-256 checksum
How to use checksums
7caf9b7e04cccb1ce1a632da371539c6e811468a664ac47a2f4604633a6c1582
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.10

Release files / graph_simulator-0.2.9-cp312-cp312-macosx_15_0_arm64.whl

Download URL graph_simulator-0.2.9-cp312-cp312-macosx_15_0_arm64.whl
Size 107.8 kB
Tags CPython 3.12 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
93a6f199b6d9f6ffefe82fcdf929f411cc7937374668878babb0fc33d91c6ec5
BLAKE2b-256 checksum
How to use checksums
b479d9f562b153fe4f818a2ca70f3a82fb29c7bda98b691ccd0b13bef07abcae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.2.9 This release

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

3 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page