Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce dependencies #1258

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/advanced-on-demand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
poetry-version: [1.5.1]
test-group: [1, 2, 3, 4]

Expand Down Expand Up @@ -54,6 +54,12 @@ jobs:
with:
poetry-version: ${{ matrix.poetry-version }}

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm

- name: Install graphviz
run: |
sudo apt install graphviz libgraphviz-dev graphviz-dev pkg-config
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/ci-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -36,6 +36,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm

- name: Install graphviz
run: |
sudo apt install graphviz libgraphviz-dev graphviz-dev pkg-config
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
poetry-version: [1.5.1]
test-group: [1, 2, 3, 4, 5, 6]

Expand All @@ -44,6 +44,12 @@ jobs:
with:
poetry-version: ${{ matrix.poetry-version }}

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2.0.5
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm

- name: Install graphviz
run: |
sudo apt install graphviz libgraphviz-dev graphviz-dev pkg-config
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ jobs:
with:
fetch-depth: 0

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2.0.5
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install Python Dependencies
run: poetry install -E plotting -E pydot -E pygraphviz -E econml --with docs

Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ jobs:
with:
fetch-depth: 0

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2.0.5
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install Python Dependencies
run: poetry install -E plotting -E pydot -E pygraphviz -E econml --with docs

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
poetry-version: [1.5.1]

steps:
Expand All @@ -27,6 +27,12 @@ jobs:
with:
poetry-version: ${{ matrix.poetry-version }}

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm

- name: Install graphviz
run: |
sudo apt install graphviz libgraphviz-dev graphviz-dev pkg-config
Expand Down
8 changes: 0 additions & 8 deletions docs/source/dowhy.graph_learners.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ dowhy.graph\_learners package
Submodules
----------

dowhy.graph\_learners.cdt module
--------------------------------

.. automodule:: dowhy.graph_learners.cdt
:members:
:undoc-members:
:show-inheritance:

dowhy.graph\_learners.ges module
--------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,7 @@ Learning the causal graph is only necessary in case we cannot construct the grap

In many cases, the true causal structure for a given dataset may not be known. We can utilize *graph discovery* algorithms to provide candidate causal graphs consistent with the dataset. Such graphs can then be inspected, edited and modified by a user to match their domain expertise or world knowledge. Note that these graphs should be not used directly because graph discovery from observational data is a provably impossible problem in the fully non-parametric setting. Given a dataset, there exist multiple graphs that would lead to the exact same joint distribution and thus are indistinguishable based on the dataset (such graphs constitute the *Markov equivalence class*). As a result, graph discovery algorithms make certain assumptions to learn a graph and do not guarantee the validity of a learned graph.

DoWhy does not implement graph discovery algorithms, but provides a simple way to input the learnt graph from a discovery algorithm. The only constraint is that DoWhy expects the algorithm to output a directed acyclic graph (DAG). In the future, we expect to support learning causal graphs directly through integration with the `causal-learn <https://github.com/py-why/causal-learn>`_ and `dodiscover <https://github.com/py-why/dodiscover>`_ packages in PyWhy.

Graph discovery using CDT
-------------------------
Given a dataset as a pandas DataFrame, the following snippet learns the graph using LiNGAM algorithm and loads it in DoWhy. The algorithm implementation is in the Causal Discovery Toolbox (CDT) package which needs to be installed separately.

>>> from cdt.causality.graph import LiNGAM
>>> causal_graph = LiNGAM().predict(dataset)

For a full example using CDT, you can refer to the :doc:`../../example_notebooks/dowhy_causal_discovery_example`.
DoWhy does not implement graph discovery algorithms, but provides a simple way to input the learnt graph from a discovery algorithm. The only constraint is that DoWhy expects a directed acyclic graph (DAG) in the form of a networkx graph. For packages that implement different causal discovery algorithms, see the `causal-learn <https://github.com/py-why/causal-learn>`_ and `dodiscover <https://github.com/py-why/dodiscover>`_ packages in PyWhy.

Graph discovery using dodiscover
--------------------------------
Expand Down
2 changes: 0 additions & 2 deletions dowhy/causal_estimators/econml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import numpy as np
import pandas as pd
from numpy.distutils.misc_util import is_sequence

from dowhy.causal_estimator import CausalEstimate, CausalEstimator
from dowhy.causal_identifier import IdentifiedEstimand
Expand Down Expand Up @@ -295,7 +294,6 @@ def shap_values(self, df: pd.DataFrame, *args, **kwargs):
def apply_multitreatment(self, df: pd.DataFrame, fun: Callable, *args, **kwargs):
ests = []
assert not isinstance(self._treatment_value, str)
assert is_sequence(self._treatment_value)

if df is None:
filtered_df = None
Expand Down
Loading
Loading