Skip to main content

Core utilities and classes for the CausalIQ ecosystem

Project description

causaliq-core

Python Versions License: MIT Coverage

This is the core package providing common functionality required by several CausalIQ packages. It is part of the CausalIQ ecosystem for intelligent causal discovery and inference.

Installation

Install from PyPI:

pip install causaliq-core

Status

🚧 Active Development - This repository is currently in active development, which involves:

  • migrating functionality from the legacy monolithic discovery repo
  • restructuring classes to reduce module size and improve maintainability and improve usability
  • ensure CausalIQ development standards are met
  • adding new core functionality required by several CausalIQ packages

Features

Currently implemented:

  • Release v0.1.0 - Foundation and utilities: CausalIQ compliant development environment and utility functions (timing, random numbers, environment detection, etc.)
  • Release v0.2.0 - Graph classes: Graph types for causal discovery including Summary Dependence Graphs (SDG), Partially Directed Acyclic Graphs (PDAG), Directed Acyclic Graphs (DAG), with conversion utilities and I/O support for Tetrad/Bayesys formats
  • Release v0.3.0 - Bayesian Networks: support for Bayesian Networks and their parameterised distributions and I/O support for DSC and XDSL formats
  • Release v0.4.0 - Caching Infrastructure: Token-based caching and (de)compression of JSON and GraphML
  • Release v0.5.0 - Aggregation Workflows: PDG (Probabilistic Dependency Graph) for uncertainty over graph structures, GraphML I/O for PDG, filter expression evaluation, and metadata-driven weight computation
  • Release v0.6.0 - Optimal DAG: Greedy optimal DAG extraction from PDG, ActionPattern enum for workflow execution patterns, and template method pattern for action providers
  • Release v0.7.0 - Randomised Filters: random() function support in filter expressions for random sampling of cache entries

Upcoming releases:

  • none planned

Quick Start

from causaliq_core.graph import PDAG, read, write

# Create a partially directed graph
pdag = PDAG(['X', 'Y', 'Z'], [('X', '->', 'Y'), ('Y', '--', 'Z')])

# Save and load graphs
write(pdag, "my_graph.csv")  # Bayesys format
loaded_graph = read("my_graph.csv")

# Convert between graph types
from causaliq_core.graph import extend_pdag
dag = extend_pdag(pdag)  # Extend PDAG to DAG

Getting started

Prerequisites

  • Git
  • Latest stable versions of Python 3.9, 3.10. 3.11, 3.12 and 3.13

Clone the new repo locally and check that it works

Clone the causaliq-core repo locally as normal

git clone https://github.com/causaliq/causaliq-core.git

Set up the Python virtual environments and activate the default Python virtual environment. You may see messages from VSCode (if you are using it as your IDE) that new Python environments are being created as the scripts/setup-env runs - these messages can be safely ignored at this stage.

scripts/setup-env -Install
scripts/activate

Check that the causaliq-core CLI is working, check that all CI tests pass, and start up the local mkdocs webserver. There should be no errors reported in any of these.

causaliq-core --help
scripts/check_ci
mkdocs serve

Enter http://127.0.0.1:8000/ in a browser and check that the causaliq-core documentation is visible.

If all of the above works, this confirms that the code is working successfully on your system.

Start work on new features

The real work of implementing the functionality of this new CausalIQ package can now begin!

Documentation

Full API documentation is available at: http://127.0.0.1:8000/ (when running mkdocs serve)

Contributing

This repository is part of the CausalIQ ecosystem. For development setup:

  1. Clone the repository
  2. Run scripts/setup-env -Install to set up environments
  3. Run scripts/check_ci to verify all tests pass
  4. Start documentation server with mkdocs serve

Supported Python Versions: 3.9, 3.10, 3.11, 3.12 , 3.13

Default Python Version: 3.11

License: MIT

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

causaliq_core-0.7.0.tar.gz (94.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

causaliq_core-0.7.0-py3-none-any.whl (107.8 kB view details)

Uploaded Python 3

File details

Details for the file causaliq_core-0.7.0.tar.gz.

File metadata

  • Download URL: causaliq_core-0.7.0.tar.gz
  • Upload date:
  • Size: 94.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for causaliq_core-0.7.0.tar.gz
Algorithm Hash digest
SHA256 3b0110aaa65a5b0e97b3ca5b3f6a32ad9dfb96de047ba79461a80cc72592fdd6
MD5 1875a9d47b3df079428e08cd10adf9a3
BLAKE2b-256 e8e2a1f444957e225cd33e40d0c6dccbbe96757f33158f1e12a77f1173afb8e9

See more details on using hashes here.

File details

Details for the file causaliq_core-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: causaliq_core-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 107.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for causaliq_core-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0da20ac9c051f6a99a5e4b07894a98720b7f2812091dfb494423935a60a086cc
MD5 9bed2ef70c33fbe990543eb0fa4a0c12
BLAKE2b-256 bd5bd47551104929605b1c1cf0421f07d20f98401e70e4447620354c64b33e51

See more details on using hashes here.

Supported by

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