Skip to content

Commit

Permalink
Update docu
Browse files Browse the repository at this point in the history
  • Loading branch information
sa-and committed Feb 29, 2024
1 parent e15d193 commit 3438ba8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
15 changes: 5 additions & 10 deletions CausalPlayground/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
interaction with causal mechanisms. Additionally, CausalPlayground offers a range of useful helper functions for generating
diverse instances of SCMs and DAGs, facilitating quantitative experimentation and evaluation. Notably, the library is
designed for easy integration with reinforcement learning methods, enhancing its utility in active inference and
learning settings. This documentation presents the complete API documentation and a quickstart guide [here](https://sa-and.github.io/CausalPlayground/).
learning settings. This documentation presents the complete API documentation and a quickstart guide.
# Installation guide (TODO)
Either clone and 'pip install -r requirements.txt'
or 'pip install CausalPlayground'
# Installation guide
In your python environment `pip install causal-playground`.
# Structural Causal Models (SCM)
SCMs are a powerful model to express a data-generating process that is governed by clear causal relations represented
Expand All @@ -25,7 +23,7 @@
## Defining an SCM
Define the SCM $\mathcal{M} = (\mathcal{X}, \mathcal{U}, \mathcal{F}, \mathcal{P})$ with
$\mathcal{X}= \\{ A, Effect \\}$, $\mathcal{U}=\\{U\\}$, $\mathcal{P}=\\{Uniform(3, 8)\\}$, and
$\mathcal{F} = \begin{cases}A\leftarrow 5+U\\\Effect \leftarrow A*2\end{cases}$
$\mathcal{F} = \\{A\leftarrow 5+U, Effect \leftarrow A*2\\}$
```Python
>>> scm = StructuralCausalModel()
Expand Down Expand Up @@ -181,15 +179,12 @@ def determine_reward(self):
exo_distribution=random.random, exo_distribution_kwargs={},
allow_exo_confounders=True)[0]
```
To generate an SCM based on a given causal structure:
Or generate a random SCM based on a given causal structure:
```Python
>>> generator.create_scm_from_graph(graph=GRAPH, possible_functions=['linear'],
exo_distribution=random.randint, exo_distribution_kwargs={'a': 2, 'b': 5})
```
`./envs/generation/functions.py` defines the functions that can be used when defining your SCM. You can either use the
pre-defined functions, or define the function that is tailored to your need.
The interface to define your own data-generating function is as follows: define an (outer) python function that takes as
input a list of strings (the parent's variable names) and outputs the (inner) data-generation function. Giving the inner
function **kwargs as parameters, allows you to access the parent variable's values. The remaining behaviour of the outer
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ diverse instances of SCMs and DAGs, facilitating quantitative experimentation an
designed for easy integration with reinforcement learning methods, enhancing its utility in active inference and
learning settings. Find the complete API documentation and a quickstart guide [here](https://sa-and.github.io/CausalPlayground/).

# Installation guide (TODO)
# Installation guide
In your python environment `pip install causal-playground`.

# Contributing
Expand All @@ -21,6 +21,6 @@ Contributions are highly welcomed and encouraged! To contribute to the project,

Alternatively, you can open a well-described issue.

# Citing this work (TODO)
# Citing this work
If you are using this library, please consider citing us:
TODO

0 comments on commit 3438ba8

Please sign in to comment.