Skip to main content

Causal discovery made easy.

Project description

[!WARNING] causy is a prototype. Please report any issues and be mindful when using it in production.

causy

causy is a command line tool that allows you to apply causal inference methods like causal discovery and causal effect estimation. You can adjust causal discovery algorithms with easy to use, extend and maintain pipelines. causy is built based on pytorch which allows you to run the algorithms on CPUs as well as GPUs.

causy workspaces allow you to manage your data sets, algorithm adjustments, and (hyper-)parameters for your experiments.

causy UI allows you to look at your resulting graphs in the browser and gain further insights into every step of the algorithms.

You can find the documentation here.

Installation

Currently, we support python 3.11 and 3.12. To install causy run

pip install causy

Usage

Causy can be used with workspaces via CLI or via code.

Workspaces Quickstart

See options for causy workspace

causy workspace --help

Create a new workspace and start the process to configure your pipeline, data loader and experiments interactively. Your input data should be a json file stored in the same directory.

causy workspace init

Add an experiment

causy workspace experiment add your_experiment_name

Update a variable in the experiment

causy workspace experiment update-variable your_experiment_name your_variable_name your_variable_value 

Run multiple experiments

causy workspace execute 

Compare the graphs of the experiments with different variable values via a matrix plot

causy workspace diff

Compare the graphs in the UI, switch between different experiments and visualize the causal discovery process

causy ui

Usage via Code

Use a default algorithm

from causy.algorithms import PC
from causy.graph_utils import retrieve_edges

model = PC()
model.create_graph_from_data(
    [
        {"a": 1, "b": 0.3},
        {"a": 0.5, "b": 0.2}
    ]
)
model.create_all_possible_edges()
model.execute_pipeline_steps()
edges = retrieve_edges(model.graph)

for edge in edges:
    print(
        f"{edge[0].name} -> {edge[1].name}: {model.graph.edges[edge[0]][edge[1]]}"
    )

Supported algorithms

Currently, causy supports the following algorithms:

  • PC (Peter-Clark)
    • PC - the original PC algorithm without any modifications causy.algorithms.PC
    • ParallelPC - a parallelized version of the PC algorithm causy.algorithms.ParallelPC

Supported pipeline steps

Detailed information about the pipeline steps can be found in the API Documentation.

Dev usage

Setup

We recommend using poetry to manage the dependencies. To install poetry follow the instructions on https://python-poetry.org/docs/#installation.

Install dependencies

poetry install

Execute tests

poetry run python -m unittest

Funded by the Prototype Fund from March 2024 until September 2024

pf_funding_logos

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

causy-0.1.26.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

causy-0.1.26-py3-none-any.whl (2.0 MB view details)

Uploaded Python 3

File details

Details for the file causy-0.1.26.tar.gz.

File metadata

  • Download URL: causy-0.1.26.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for causy-0.1.26.tar.gz
Algorithm Hash digest
SHA256 5a55467a3ad63a45719579fbc1c3bfd7a2d8735af49d564e92410704a6928b9a
MD5 c078915ac2539b96958ec92362d60e07
BLAKE2b-256 3734a528aab82d621191346d78bb2385b568e4aa7cd225e257f2bf4831dfb0e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for causy-0.1.26.tar.gz:

Publisher: release.yml on causy-dev/causy

Attestations:

File details

Details for the file causy-0.1.26-py3-none-any.whl.

File metadata

  • Download URL: causy-0.1.26-py3-none-any.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for causy-0.1.26-py3-none-any.whl
Algorithm Hash digest
SHA256 6316baa6edbbb61f9f2d8e13c32df19c03c836eb10f416d5ab6fcb30ca92a05b
MD5 a56b8d1628ef9f343950a5d30505b824
BLAKE2b-256 e9eebae0b56d6bc102fff202d9654424c80ad81355b8773aadef3098fa568f93

See more details on using hashes here.

Provenance

The following attestation bundles were made for causy-0.1.26-py3-none-any.whl:

Publisher: release.yml on causy-dev/causy

Attestations:

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