Skip to main content

Causal Graphical Models

Project description

Causal Graphical Models

A python library for building causal graphical models, closely following Daphne Koller's Coursera course on Probabilistic Graphical Models, and her 2009 book Probabilistic Graphical Models: Principles and Techniques. The source for this project is available here.

Installation

NumPy is the only dependency. Python version must be >= 3.7.

pip install cgm

Usage

import numpy as np
import cgm

np.random.seed(30)
# Define all nodes
A = cgm.DAG_Node('A', 3)
B = cgm.DAG_Node('B', 3)
C = cgm.DAG_Node('C', 3)
D = cgm.DAG_Node('D', 3)
# Specify all parents of nodes
cgm.CPD(B, [A])
cgm.CPD(C, [B])
cgm.CPD(D, [A, B])
nodes = [A, B, C, D]
# Create graph
graph = cgm.DAG(nodes)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cgm-0.0.2.tar.gz (4.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page