Skip to content

Commit 57eb8e4

Browse files
authored
Updated to "Move log transform to causica" (#99)
* Updated to "Move log transform to causica" * Fix the usage of tempfile in test_generate_data Replace mktemp with mkstemp * Update the version of the release
1 parent f20772b commit 57eb8e4

File tree

60 files changed

+5080
-2294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+5080
-2294
lines changed

.devcontainer/devcontainer.json

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,37 @@
2525
"customizations": {
2626
"vscode": {
2727
"settings": {
28+
// General
29+
"editor.rulers": [120],
30+
"terminal.integrated.profiles.linux": {
31+
"zsh": {"path": "/usr/bin/zsh"}
32+
},
33+
"terminal.integrated.defaultProfile.linux": "zsh",
34+
35+
// Python
36+
"[python]": {
37+
"editor.defaultFormatter": "ms-python.black-formatter"
38+
},
2839
"python.defaultInterpreterPath": "/usr/bin/python",
29-
"python.formatting.black": true,
30-
"python.linting.pylint": true,
3140
"python.testing.pytestEnabled": true,
3241
"python.testing.pytestArgs": [
3342
"--continue-on-collection-errors",
3443
"test"
3544
],
3645
"python.testing.unittestEnabled": false,
37-
"vim.textwidth": 120,
38-
"editor.rulers": [
39-
120
40-
],
41-
"terminal.integrated.profiles.linux": {
42-
"zsh": {
43-
"path": "/usr/bin/zsh"
44-
}
45-
},
46-
"terminal.integrated.defaultProfile.linux": "zsh"
46+
47+
// Extensions
48+
"isort.args": ["--resolve-all-configs"],
49+
"black-formatter.args": ["--config=./pyproject.toml"],
50+
"vim.textwidth": 120
4751
},
4852
"extensions": [
4953
"bungcip.better-toml",
5054
"github.copilot",
5155
"github.copilot-chat",
5256
"github.copilot-labs",
5357
"ms-azuretools.vscode-docker",
58+
"ms-python.black-formatter",
5459
"ms-python.isort",
5560
"ms-python.pylint",
5661
"ms-python.python",

.github/workflows/ci-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install dependencies
3333
run: |
3434
poetry env use 3.10
35-
poetry install
35+
poetry install --extras seaborn
3636
if: steps.cache.outputs.cache-hit != 'true'
3737

3838
- name: Verify pre-commit checks

.gitignore

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,4 @@
1-
/runs/
2-
/runs_opt/
3-
/data/*
4-
**/mlruns/
5-
/.vscode
6-
*.code-workspace
7-
__pycache__/
8-
/api/data
9-
/api/models
10-
/saved_models/
11-
/tests/regression_tests/data/
12-
/plots/
13-
/evaluation_pipeline/local_logs/*
14-
/experiements/GNN
15-
/experiments/data
16-
!/experiments/data/*ipynb
17-
research_experiments/NRI/data/*.npy
18-
research_experiments/NRI/logs/
19-
research_experiments/visl/
20-
research_experiments/set_transformer/set_transformer_paper/data/
21-
research_experiments/set_transformer/set_transformer_paper/results/
22-
research_experiments/e2e_causal_inference/data_generation/data
23-
research_experiments/e2e_causal_inference/config_files
24-
.tmp/
25-
git_info.txt
26-
run*kwargs*.json
27-
*.ipynb_checkpoints
28-
icml/
29-
outputs/
30-
research_experiments/context_bayes/plots
31-
32-
# Workaround for git to keep empty data/ directory around
33-
!/data/.keep
34-
research_experiments/**/*.ipynb
1+
/runs/
2+
__pycache__/
3+
.ipynb_checkpoints/
4+
docs/build/

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
hooks:
1212
- id: isort
1313
name: isort
14-
entry: poetry run isort
14+
entry: poetry run isort --resolve-all-configs
1515
language: system
1616
types: [python]
1717
- repo: local

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ENV POETRY_CACHE_DIR="/root/.cache/pypoetry" \
2222
POETRY_NO_INTERACTION=1 \
2323
POETRY_VIRTUALENVS_CREATE=false \
2424
POETRY_VIRTUALENVS_IN_PROJECT=false \
25-
POETRY_VERSION=1.6.1
25+
POETRY_VERSION=1.7.1
2626
ENV PATH="$PATH:$POETRY_HOME/bin"
2727
RUN curl -sSL https://install.python-poetry.org | python3 -
2828

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ The Spline model uses a flexible spline flow that is learnt from the data. This
6262

6363
To use DECI to learn the functional relationships, remove the variational distribution terms from the loss and replace the sample with the known graph.
6464

65+
**Example using the CLI**
66+
67+
An example of how to run a training job with the noise distribution specified in the config `src/causica/config/lightning/default_gaussian.yaml` and the data configuration specified in `src/causica/config/lightning/default_data.yaml`:
68+
69+
```
70+
python -m causica.lightning.main \
71+
--config src/causica/config/lightning/default_gaussian.yaml --data src/causica/config/lightning/default_data.yaml
72+
```
73+
74+
6575
## Further extensions
6676

6777
For now, we have removed Rhino and DDECI from the codebase but they will be added back. You can still access the previously released versions [here](https://github.com/microsoft/causica/releases/tag/v0.0.0).

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = src
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Documentation
2+
3+
This documentation relies on `sphinx` and `autoapi` to generate the documentation from the source code.
4+
5+
It can be built using the following command:
6+
7+
```console
8+
make html
9+
```
10+
11+
This generates the documentation in the `build/html` directory.
12+
13+
# Helpful Resources
14+
- https://docs.readthedocs.io/en/stable/guides/jupyter.html
15+
- https://coderefinery.github.io/documentation/gh_workflow/
16+
- https://www.sphinx-doc.org/en/master/tutorial/deploying.html#publishing-sources
17+
- https://coderefinery.github.io/documentation/sphinx/
18+
- https://github.com/brechtm/rinohtype/blob/master/.github/workflows/tests.yml (for examples of a versioned documentation)
19+
- https://stackoverflow.com/questions/72089650/how-to-host-multiple-version-of-a-sphinx-based-documentation-on-github

docs/src/conf.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
import importlib.metadata as importlib_metadata
7+
import time
8+
9+
# -- Project information -----------------------------------------------------
10+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
11+
12+
distribution = importlib_metadata.distribution("causica")
13+
14+
project = distribution.metadata["Name"]
15+
author = distribution.metadata["Author"] or "Microsoft Research - Causica"
16+
copyright = f"{time.strftime('%Y')}, {author} and contributors" # pylint: disable=redefined-builtin
17+
18+
# The version info for the project you"re documenting, acts as replacement for
19+
# |version| and |release|, also used in various other places throughout the
20+
# built documents.
21+
#
22+
# The short X.Y version.
23+
version = distribution.version
24+
# The full version, including alpha/beta/rc tags.
25+
release = version
26+
27+
# -- General configuration ---------------------------------------------------
28+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
29+
# this helped:
30+
# https://stackoverflow.com/questions/2701998/automatically-document-all-modules-recursively-with-sphinx-autodoc
31+
extensions = [
32+
"sphinx.ext.autodoc",
33+
"sphinx.ext.coverage",
34+
"sphinx.ext.githubpages",
35+
"sphinx.ext.mathjax",
36+
"sphinx.ext.napoleon",
37+
"sphinx.ext.viewcode",
38+
"autoapi.extension",
39+
"myst_parser",
40+
"numpydoc",
41+
"sphinx_immaterial",
42+
]
43+
44+
templates_path = ["templates"]
45+
exclude_patterns = ["Thumbs.db", ".DS_Store"]
46+
autoapi_dirs = ["../../src/causica/"]
47+
autoapi_template_dir = "templates/autoapi"
48+
49+
# Napoleon settings
50+
napoleon_google_docstring = True
51+
napoleon_numpy_docstring = True
52+
napoleon_include_init_with_doc = True
53+
napoleon_include_private_with_doc = True
54+
napoleon_include_special_with_doc = True
55+
napoleon_use_admonition_for_examples = False
56+
napoleon_use_admonition_for_notes = False
57+
napoleon_use_admonition_for_references = False
58+
napoleon_use_ivar = False
59+
napoleon_use_param = True
60+
napoleon_use_rtype = True
61+
62+
# The name of the Pygments (syntax highlighting) style to use.
63+
pygments_style = "sphinx"
64+
65+
# -- Options for HTML output -------------------------------------------------
66+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
67+
68+
# The theme to use for HTML and HTML Help pages. See the documentation for
69+
# a list of builtin themes.
70+
html_theme = "sphinx_immaterial"
71+
html_static_path = ["static"]
72+
73+
# Theme options are theme-specific and customize the look and feel of a theme
74+
# further. For a list of options available for each theme, see the
75+
# documentation.
76+
html_theme_options = {
77+
"features": [
78+
"navigation.sections",
79+
"navigation.instant",
80+
"navigation.path",
81+
"navigation.prune",
82+
],
83+
"globaltoc_collapse": False,
84+
"repo_url": "https://github.com/microsoft/causica",
85+
"repo_name": "causica",
86+
"edit_uri": "edit/master/doc",
87+
"palette": [
88+
{
89+
"media": "(prefers-color-scheme: light)",
90+
"scheme": "default",
91+
"primary": "red",
92+
"accent": "light-blue",
93+
"toggle": {
94+
"icon": "material/lightbulb-outline",
95+
"name": "Switch to dark mode",
96+
},
97+
},
98+
{
99+
"media": "(prefers-color-scheme: dark)",
100+
"scheme": "slate",
101+
"primary": "red",
102+
"accent": "orange",
103+
"toggle": {
104+
"icon": "material/lightbulb",
105+
"name": "Switch to light mode",
106+
},
107+
},
108+
],
109+
"toc_title_is_page_title": True,
110+
"version_dropdown": True,
111+
"version_json": "../im_versions.json",
112+
}
113+
114+
# The master toctree document.
115+
master_doc = "index"

docs/src/index.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Causica Documentation
2+
3+
```{eval-rst}
4+
.. toctree::
5+
:hidden:
6+
7+
Home <self>
8+
9+
10+
```
11+
12+
```{eval-rst}
13+
.. toctree::
14+
:hidden:
15+
:maxdepth: 2
16+
```
17+
18+
This is the documentation for Causica, a Python package for causal discovery and inference.

0 commit comments

Comments
 (0)