-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
447 additions
and
612 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,33 +26,3 @@ jobs: | |
- uses: pre-commit/[email protected] | ||
with: | ||
extra_args: --all-files --show-diff-on-failure | ||
|
||
pyright: | ||
name: Check types | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
lfs: false | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Cache dependency | ||
id: cache-dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ubuntu-latest-pip-3.9 | ||
restore-keys: | | ||
ubuntu-latest-pip- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e .[dev] | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.9.0 | ||
hooks: | ||
- id: ruff | ||
- id: ruff-format | ||
args: [--diff] | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
args: [--fix=lf] | ||
- id: trailing-whitespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Contributing | ||
|
||
We invite contributions of new algorithms, tasks, and metrics. Please do not hestitate to get in touch [via email](mailto:[email protected],[email protected]) or by opening an issue on the repository. | ||
We invite contributions of new algorithms, tasks, and metrics. Please do not hestitate to get in touch [via email](mailto:[email protected],[email protected]) or by opening an issue on the repository. | ||
|
||
## Setup | ||
|
||
|
@@ -19,19 +19,19 @@ source my-branch-venv/bin/activate | |
Upgrade pip: | ||
|
||
```bash | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade pip | ||
``` | ||
|
||
Install dependencies including extras for development: | ||
|
||
```bash | ||
python -m pip install -e .[dev] | ||
python -m pip install -e .[dev] | ||
``` | ||
|
||
Run the tests (this currently takes quite a while): | ||
|
||
```bash | ||
python -m pytest -x . | ||
python -m pytest -x . | ||
``` | ||
|
||
To complete, run house keeping apps and try to make all errors disappear: | ||
|
@@ -51,7 +51,7 @@ Now commit and push your changes to github and open a PR. Thank you! | |
|
||
Adding new tasks is straightforward. It is easiest to model them after existing tasks. First, take a close look at the base class for tasks in `sbibm/tasks/task.py`: you will find a `_setup` method: This method samples from the prior, generates observations, and finally calls `_sample_reference_posterior`, to generate samples from the reference posterior. All of these results are stored in csv files, and the generation of reference posterior samples happens in parallel. | ||
|
||
For some tasks, e.g., the `gaussian_linear`, a closed form solution for the posterior is available, which is used in `_sample_reference_posterior`, while other tasks utilize MCMC. | ||
For some tasks, e.g., the `gaussian_linear`, a closed form solution for the posterior is available, which is used in `_sample_reference_posterior`, while other tasks utilize MCMC. | ||
|
||
Note also that each individual tasks ends with a `if __name__ == "__main__"` block at the end which calls `_setup`. This means that `_setup` is executed by calling `python sbibm/tasks/task_name/task.py`. This step overrides the existing reference posterior data, which is in the subfolder `sbibm/tasks/task_name/files/`. It should only be executed whenever a task is changed (and never by a user). | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.