flowMC 0.3.4__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flowmc-0.4.0/.coverage +0 -0
- flowmc-0.4.0/.gitattributes +2 -0
- flowmc-0.4.0/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- flowmc-0.4.0/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- flowmc-0.4.0/.github/workflows/pre-commit.yml +28 -0
- flowmc-0.4.0/.github/workflows/python-publish.yml +41 -0
- flowmc-0.4.0/.github/workflows/run_tests.yml +38 -0
- flowmc-0.4.0/.github/workflows/workflowsjoss.yml +29 -0
- flowmc-0.4.0/.gitignore +15 -0
- flowmc-0.4.0/.pre-commit-config.yaml +22 -0
- flowmc-0.4.0/CODE_OF_CONDUCT.md +83 -0
- flowmc-0.4.0/CONTRIBUTING.md +53 -0
- {flowmc-0.3.4/src/flowMC.egg-info → flowmc-0.4.0}/PKG-INFO +56 -19
- {flowmc-0.3.4 → flowmc-0.4.0}/README.md +4 -3
- flowmc-0.4.0/docs/FAQ.md +37 -0
- flowmc-0.4.0/docs/communityExamples.md +13 -0
- flowmc-0.4.0/docs/configuration.md +129 -0
- flowmc-0.4.0/docs/contribution.md +1 -0
- flowmc-0.4.0/docs/dual_moon.png +0 -0
- flowmc-0.4.0/docs/gen_ref_pages.py +33 -0
- flowmc-0.4.0/docs/index.md +29 -0
- flowmc-0.4.0/docs/logo_0810.png +0 -0
- flowmc-0.4.0/docs/quickstart.md +192 -0
- flowmc-0.4.0/docs/requirements.txt +7 -0
- flowmc-0.4.0/docs/stylesheets/extra.css +5 -0
- flowmc-0.4.0/docs/tutorials/custom_strategy.ipynb +283 -0
- flowmc-0.4.0/docs/tutorials/dual_moon.png +0 -0
- flowmc-0.4.0/docs/tutorials/dualmoon.ipynb +521 -0
- flowmc-0.4.0/docs/tutorials/loading_resources.ipynb +552 -0
- flowmc-0.4.0/docs/tutorials/train_normalizing_flow.ipynb +508 -0
- flowmc-0.4.0/joss/paper.bib +167 -0
- flowmc-0.4.0/joss/paper.md +101 -0
- flowmc-0.4.0/mkdocs.yml +88 -0
- flowmc-0.4.0/pyproject.toml +80 -0
- flowmc-0.4.0/readthedocs.yml +15 -0
- flowmc-0.4.0/ruff.toml +1 -0
- flowmc-0.4.0/src/flowMC/Sampler.py +104 -0
- flowmc-0.4.0/src/flowMC/resource/base.py +38 -0
- flowmc-0.4.0/src/flowMC/resource/buffers.py +64 -0
- flowmc-0.4.0/src/flowMC/resource/local_kernel/Gaussian_random_walk.py +71 -0
- flowmc-0.4.0/src/flowMC/resource/local_kernel/HMC.py +159 -0
- flowmc-0.4.0/src/flowMC/resource/local_kernel/MALA.py +99 -0
- flowmc-0.4.0/src/flowMC/resource/local_kernel/base.py +39 -0
- flowmc-0.4.0/src/flowMC/resource/nf_model/NF_proposal.py +126 -0
- {flowmc-0.3.4/src/flowMC/nfmodel → flowmc-0.4.0/src/flowMC/resource/nf_model}/base.py +111 -50
- {flowmc-0.3.4/src/flowMC/nfmodel → flowmc-0.4.0/src/flowMC/resource/nf_model}/common.py +75 -36
- {flowmc-0.3.4/src/flowMC/nfmodel → flowmc-0.4.0/src/flowMC/resource/nf_model}/realNVP.py +42 -33
- {flowmc-0.3.4/src/flowMC/nfmodel → flowmc-0.4.0/src/flowMC/resource/nf_model}/rqSpline.py +59 -41
- flowmc-0.4.0/src/flowMC/resource/optimizer.py +35 -0
- flowmc-0.4.0/src/flowMC/resource_strategy_bundles.py +161 -0
- flowmc-0.4.0/src/flowMC/strategy/base.py +31 -0
- flowmc-0.4.0/src/flowMC/strategy/global_tuning.py +116 -0
- flowmc-0.4.0/src/flowMC/strategy/optimization.py +131 -0
- flowmc-0.4.0/src/flowMC/strategy/take_steps.py +156 -0
- flowmc-0.4.0/src/flowMC/strategy/train_model.py +110 -0
- flowmc-0.4.0/test/integration/test_HMC.py +73 -0
- flowmc-0.4.0/test/integration/test_MALA.py +66 -0
- flowmc-0.4.0/test/integration/test_RWMCMC.py +73 -0
- flowmc-0.4.0/test/integration/test_normalizingFlow.py +60 -0
- flowmc-0.4.0/test/integration/test_quickstart.py +51 -0
- flowmc-0.4.0/test/unit/test_kernels.py +365 -0
- flowmc-0.4.0/test/unit/test_nf.py +73 -0
- flowmc-0.4.0/test/unit/test_resources.py +16 -0
- flowmc-0.4.0/test/unit/test_strategies.py +258 -0
- flowmc-0.4.0/uv.lock +2543 -0
- flowmc-0.3.4/PKG-INFO +0 -129
- flowmc-0.3.4/pyproject.toml +0 -3
- flowmc-0.3.4/setup.cfg +0 -33
- flowmc-0.3.4/src/flowMC/Sampler.py +0 -433
- flowmc-0.3.4/src/flowMC/proposal/Gaussian_random_walk.py +0 -120
- flowmc-0.3.4/src/flowMC/proposal/HMC.py +0 -216
- flowmc-0.3.4/src/flowMC/proposal/MALA.py +0 -203
- flowmc-0.3.4/src/flowMC/proposal/NF_proposal.py +0 -223
- flowmc-0.3.4/src/flowMC/proposal/base.py +0 -154
- flowmc-0.3.4/src/flowMC/proposal/flowHMC.py +0 -256
- flowmc-0.3.4/src/flowMC/strategy/base.py +0 -40
- flowmc-0.3.4/src/flowMC/strategy/global_tuning.py +0 -322
- flowmc-0.3.4/src/flowMC/strategy/optimization.py +0 -197
- flowmc-0.3.4/src/flowMC/utils/EvolutionaryOptimizer.py +0 -126
- flowmc-0.3.4/src/flowMC/utils/PythonFunctionWrap.py +0 -139
- flowmc-0.3.4/src/flowMC/utils/postprocessing.py +0 -62
- flowmc-0.3.4/src/flowMC.egg-info/SOURCES.txt +0 -32
- flowmc-0.3.4/src/flowMC.egg-info/dependency_links.txt +0 -1
- flowmc-0.3.4/src/flowMC.egg-info/requires.txt +0 -7
- flowmc-0.3.4/src/flowMC.egg-info/top_level.txt +0 -1
- {flowmc-0.3.4 → flowmc-0.4.0}/LICENSE +0 -0
- {flowmc-0.3.4 → flowmc-0.4.0}/src/flowMC/__init__.py +0 -0
- {flowmc-0.3.4/src/flowMC/nfmodel → flowmc-0.4.0/src/flowMC/resource}/__init__.py +0 -0
- {flowmc-0.3.4/src/flowMC/proposal → flowmc-0.4.0/src/flowMC/resource/local_kernel}/__init__.py +0 -0
- {flowmc-0.3.4/src/flowMC/strategy → flowmc-0.4.0/src/flowMC/resource/nf_model}/__init__.py +0 -0
- {flowmc-0.3.4/src/flowMC/utils → flowmc-0.4.0/src/flowMC/strategy}/__init__.py +0 -0
- {flowmc-0.3.4 → flowmc-0.4.0}/src/flowMC/strategy/importance_sampling.py +0 -0
flowmc-0.4.0/.coverage
ADDED
|
Binary file
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Go to '...'
|
|
16
|
+
2. Click on '....'
|
|
17
|
+
3. Scroll down to '....'
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Screenshots**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. iOS]
|
|
28
|
+
- Browser [e.g. chrome, safari]
|
|
29
|
+
- Version [e.g. 22]
|
|
30
|
+
|
|
31
|
+
**Smartphone (please complete the following information):**
|
|
32
|
+
- Device: [e.g. iPhone6]
|
|
33
|
+
- OS: [e.g. iOS8.1]
|
|
34
|
+
- Browser [e.g. stock browser, safari]
|
|
35
|
+
- Version [e.g. 22]
|
|
36
|
+
|
|
37
|
+
**Additional context**
|
|
38
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: pre-commit
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
|
|
10
|
+
pre-commit:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.11", "3.12"]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
+
uses: actions/setup-python@v3
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: |
|
|
24
|
+
python -m pip install --upgrade pip
|
|
25
|
+
python -m pip install pytest
|
|
26
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
27
|
+
python -m pip install .
|
|
28
|
+
- uses: pre-commit/action@v3.0.1
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# This workflow will upload a Python Package using Twine when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
+
# They are provided by a third-party and are governed by
|
|
6
|
+
# separate terms of service, privacy policy, and support
|
|
7
|
+
# documentation.
|
|
8
|
+
|
|
9
|
+
name: Upload Python Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
workflow_dispatch:
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
deploy:
|
|
22
|
+
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v3
|
|
27
|
+
- name: Set up Python
|
|
28
|
+
uses: actions/setup-python@v3
|
|
29
|
+
with:
|
|
30
|
+
python-version: '3.x'
|
|
31
|
+
- name: Install dependencies
|
|
32
|
+
run: |
|
|
33
|
+
python -m pip install --upgrade pip
|
|
34
|
+
pip install build
|
|
35
|
+
- name: Build package
|
|
36
|
+
run: python -m build
|
|
37
|
+
- name: Publish package
|
|
38
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
39
|
+
with:
|
|
40
|
+
user: __token__
|
|
41
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
+
|
|
4
|
+
name: Run Tests
|
|
5
|
+
|
|
6
|
+
on: [push, pull_request]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.11", "3.12"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Install uv
|
|
22
|
+
uses: astral-sh/setup-uv@v3
|
|
23
|
+
|
|
24
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
25
|
+
run: uv python install ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Install the project
|
|
28
|
+
run: uv sync --all-extras --dev
|
|
29
|
+
|
|
30
|
+
- name: Run tests and coverage
|
|
31
|
+
run: |
|
|
32
|
+
uv run coverage run --source=src -m pytest test
|
|
33
|
+
uv run coveralls --service=github-actions
|
|
34
|
+
env:
|
|
35
|
+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
|
36
|
+
|
|
37
|
+
- name: Run build
|
|
38
|
+
run: uv build
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Update-Joss
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- 40-joss-paper
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
paper:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
name: Paper Draft
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v2
|
|
16
|
+
- name: Build draft PDF
|
|
17
|
+
uses: openjournals/openjournals-draft-action@master
|
|
18
|
+
with:
|
|
19
|
+
journal: joss
|
|
20
|
+
# This should be the path to the paper within your repo.
|
|
21
|
+
paper-path: joss/paper.md
|
|
22
|
+
- name: Upload
|
|
23
|
+
uses: actions/upload-artifact@v1
|
|
24
|
+
with:
|
|
25
|
+
name: paper
|
|
26
|
+
# This is the output path where Pandoc will write the compiled
|
|
27
|
+
# PDF. Note, this should be the same directory as the input
|
|
28
|
+
# paper.md
|
|
29
|
+
path: joss/paper.pdf
|
flowmc-0.4.0/.gitignore
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
*.pyc
|
|
2
|
+
flowMC/nfmodel/__pycache__/maf.cpython-37.pyc
|
|
3
|
+
log_dir/
|
|
4
|
+
*.pkl
|
|
5
|
+
flowMC/nfmodel/realNVP_white.py
|
|
6
|
+
example/kepler/kepler_white.py
|
|
7
|
+
example/kepler/kepler_analyse.py
|
|
8
|
+
dist
|
|
9
|
+
*egg-info*
|
|
10
|
+
docs/build/*
|
|
11
|
+
*_autosummary
|
|
12
|
+
README.md
|
|
13
|
+
*settings.json
|
|
14
|
+
*build*
|
|
15
|
+
test_docs/test_quickstart.ipynb
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/ambv/black
|
|
3
|
+
rev: 25.1.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: black
|
|
6
|
+
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
|
7
|
+
rev: 'v0.9.10'
|
|
8
|
+
hooks:
|
|
9
|
+
- id: ruff
|
|
10
|
+
args: ["--fix"]
|
|
11
|
+
- repo: https://github.com/RobertCraigie/pyright-python
|
|
12
|
+
rev: v1.1.396
|
|
13
|
+
hooks:
|
|
14
|
+
- id: pyright
|
|
15
|
+
additional_dependencies: [beartype, einops, jax, jaxtyping, pytest, typing_extensions, equinox, optax, tqdm]
|
|
16
|
+
- repo: https://github.com/nbQA-dev/nbQA
|
|
17
|
+
rev: 1.9.1
|
|
18
|
+
hooks:
|
|
19
|
+
- id: nbqa-black
|
|
20
|
+
additional_dependencies: [ipython==8.12, black]
|
|
21
|
+
- id: nbqa-ruff-format
|
|
22
|
+
additional_dependencies: [ipython==8.12, ruff]
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
kazewong.physics@gmail.com.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Attribution
|
|
71
|
+
|
|
72
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
73
|
+
version 2.0, available at
|
|
74
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
75
|
+
|
|
76
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
77
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
78
|
+
|
|
79
|
+
[homepage]: https://www.contributor-covenant.org
|
|
80
|
+
|
|
81
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
82
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
83
|
+
https://www.contributor-covenant.org/translations.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
### Expectations
|
|
3
|
+
|
|
4
|
+
flowMC is developed and maintained in my spare time and, while I try to be
|
|
5
|
+
responsive, I don't always get to every issue immediately. If it has been more
|
|
6
|
+
than a week or two, feel free to ping me (@kazewong) to try to get my attention. This is
|
|
7
|
+
subject to changes as the community grows.
|
|
8
|
+
|
|
9
|
+
### Did you find a bug?
|
|
10
|
+
|
|
11
|
+
**Ensure the bug was not already reported** by searching on GitHub under
|
|
12
|
+
[Issues](https://github.com/kazewong/flowMC/issues). If you're unable to find an
|
|
13
|
+
open issue addressing the problem, [open a new
|
|
14
|
+
one](https://github.com/kazewong/flowMC/issues/new). Be sure to include a **title
|
|
15
|
+
and clear description**, as much relevant information as possible, and the
|
|
16
|
+
simplest possible **code sample** demonstrating the expected behavior that is
|
|
17
|
+
not occurring. Also label the issue with the bug label.
|
|
18
|
+
|
|
19
|
+
### Did you write a patch that fixes a bug?
|
|
20
|
+
|
|
21
|
+
Open a new GitHub pull request with the patch. Ensure the PR description clearly
|
|
22
|
+
describes the problem and solution. Include the relevant issue number if
|
|
23
|
+
applicable.
|
|
24
|
+
|
|
25
|
+
### Do you intend to add a new feature or change an existing feature?
|
|
26
|
+
|
|
27
|
+
Please follow the following principle when you are thinking about adding a new
|
|
28
|
+
feature or changing an existing feature:
|
|
29
|
+
|
|
30
|
+
1. The new feature should be able to take advantage of `jax.jit` whenever possible.
|
|
31
|
+
2. Light weight and modular implementation is preferred.
|
|
32
|
+
3. The core package only does sampling. If you have a concrete example that
|
|
33
|
+
involves a complete analysis such as plotting and models, see the next
|
|
34
|
+
contribution guide.
|
|
35
|
+
|
|
36
|
+
Suggestions for new features are welcome on [flowMC support
|
|
37
|
+
group](https://groups.google.com/u/1/g/flowmc). Note that features related to the
|
|
38
|
+
core algorithm are unlikely to be accepted since that may include a lot of
|
|
39
|
+
breaking changes.
|
|
40
|
+
|
|
41
|
+
### Do you intend to introduce an example or tutorial?
|
|
42
|
+
|
|
43
|
+
Open a new GitHub pull request with the example or tutorial. The example should
|
|
44
|
+
be self-contained and keep import from other packages to minimal. Leave the
|
|
45
|
+
case-specific analysis detail out. For more extensive tutorial, we encourage the
|
|
46
|
+
community to link the minimal example hosted on the flowMC documentation to
|
|
47
|
+
documentation from other packages.
|
|
48
|
+
|
|
49
|
+
### Do you have question about the code?
|
|
50
|
+
|
|
51
|
+
Do not open an issue. Instead, find whether there are already existing threads
|
|
52
|
+
on the [flowMC support group](https://groups.google.com/u/1/g/flowmc). If not,
|
|
53
|
+
please open a new conversation there.
|
|
@@ -1,33 +1,70 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: flowMC
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Normalizing flow exhanced sampler in jax
|
|
5
|
-
|
|
6
|
-
Author:
|
|
7
|
-
Author-email: kazewong.physics@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
Project-URL: Documentation, https://github.com/kazewong/flowMC
|
|
6
|
+
Author: Marylou Gabrié, Dan Foreman-Mackey
|
|
7
|
+
Author-email: Kaze Wong <kazewong.physics@gmail.com>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2022 Kaze Wong & contributor
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
12
29
|
License-File: LICENSE
|
|
13
|
-
|
|
14
|
-
Requires-
|
|
15
|
-
Requires-Dist:
|
|
16
|
-
Requires-Dist:
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
30
|
+
Keywords: autodiff,inference,jax,machine learning,normalizing,sampling
|
|
31
|
+
Requires-Python: >=3.11
|
|
32
|
+
Requires-Dist: chex>=0.1.87
|
|
33
|
+
Requires-Dist: coveralls>=4.0.1
|
|
34
|
+
Requires-Dist: equinox>=0.11.9
|
|
35
|
+
Requires-Dist: jax[cuda12]==0.5.0
|
|
36
|
+
Requires-Dist: jaxtyping>=0.2.36
|
|
37
|
+
Requires-Dist: optax>=0.2.4
|
|
38
|
+
Requires-Dist: pre-commit==4.0.1
|
|
39
|
+
Requires-Dist: pyright==1.1.389
|
|
40
|
+
Requires-Dist: pytest==8.3.3
|
|
41
|
+
Requires-Dist: ruff==0.8.0
|
|
42
|
+
Requires-Dist: scikit-learn>=1.6.0
|
|
43
|
+
Requires-Dist: tqdm>=4.67.1
|
|
44
|
+
Provides-Extra: docs
|
|
45
|
+
Requires-Dist: mkdocs-gen-files==0.5.0; extra == 'docs'
|
|
46
|
+
Requires-Dist: mkdocs-jupyter==0.25.1; extra == 'docs'
|
|
47
|
+
Requires-Dist: mkdocs-literate-nav==0.6.1; extra == 'docs'
|
|
48
|
+
Requires-Dist: mkdocs-material==9.5.47; extra == 'docs'
|
|
49
|
+
Requires-Dist: mkdocs==1.6.1; extra == 'docs'
|
|
50
|
+
Requires-Dist: mkdocstrings[python]==0.27.0; extra == 'docs'
|
|
51
|
+
Requires-Dist: pymdown-extensions==10.12; extra == 'docs'
|
|
52
|
+
Provides-Extra: visualize
|
|
53
|
+
Requires-Dist: arviz>=0.21.0; extra == 'visualize'
|
|
54
|
+
Requires-Dist: corner>=2.2.3; extra == 'visualize'
|
|
55
|
+
Description-Content-Type: text/markdown
|
|
20
56
|
|
|
21
57
|
# flowMC
|
|
22
58
|
|
|
23
59
|
**Normalizing-flow enhanced sampling package for probabilistic inference**
|
|
24
60
|
|
|
25
61
|
<a href="https://flowmc.readthedocs.io/en/main/">
|
|
26
|
-
<img src="https://
|
|
62
|
+
<img src="https://readthedocs.org/projects/flowmc/badge/?version=main&style=flat-square" alt="doc"/>
|
|
27
63
|
</a>
|
|
28
|
-
<a href="https://github.com/kazewong/
|
|
29
|
-
<img src="https://
|
|
64
|
+
<a href="https://github.com/kazewong/flowMC/blob/Packaging/LICENSE">
|
|
65
|
+
<img src="https://img.shields.io/badge/License-MIT-blue?style=flat-square" alt="doc"/>
|
|
30
66
|
</a>
|
|
67
|
+
<a href='https://coveralls.io/github/kazewong/flowMC?branch=main'><img src='https://img.shields.io/coverallsCoverage/github/kazewong/flowMC?style=flat-square' alt='Coverage Status' /></a>
|
|
31
68
|
|
|
32
69
|

|
|
33
70
|
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
**Normalizing-flow enhanced sampling package for probabilistic inference**
|
|
4
4
|
|
|
5
5
|
<a href="https://flowmc.readthedocs.io/en/main/">
|
|
6
|
-
<img src="https://
|
|
6
|
+
<img src="https://readthedocs.org/projects/flowmc/badge/?version=main&style=flat-square" alt="doc"/>
|
|
7
7
|
</a>
|
|
8
|
-
<a href="https://github.com/kazewong/
|
|
9
|
-
<img src="https://
|
|
8
|
+
<a href="https://github.com/kazewong/flowMC/blob/Packaging/LICENSE">
|
|
9
|
+
<img src="https://img.shields.io/badge/License-MIT-blue?style=flat-square" alt="doc"/>
|
|
10
10
|
</a>
|
|
11
|
+
<a href='https://coveralls.io/github/kazewong/flowMC?branch=main'><img src='https://img.shields.io/coverallsCoverage/github/kazewong/flowMC?style=flat-square' alt='Coverage Status' /></a>
|
|
11
12
|
|
|
12
13
|

|
|
13
14
|
|
flowmc-0.4.0/docs/FAQ.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
FAQ
|
|
2
|
+
===
|
|
3
|
+
|
|
4
|
+
**My local sampler is not accepting**
|
|
5
|
+
|
|
6
|
+
This usually means you are setting the step size of the local samplerto be too big.
|
|
7
|
+
Try reducing the step size in your local sampler.
|
|
8
|
+
|
|
9
|
+
Alternative, this could also mean your sampler is proposing in region where the likelihood is ill-defined (i.e. NaN either in likelihood or its derivative if you are using a gradient-based local sampler).
|
|
10
|
+
It is worth making sure your likelihood is well-defined within your range of prior.
|
|
11
|
+
|
|
12
|
+
**In order for my local sampler to accept, I have to choose a very small step size, which makes my chain very correlated.**
|
|
13
|
+
|
|
14
|
+
This usually indicate some of your parameters are much better measured than others.
|
|
15
|
+
Since taking a small step in those directions will already change your likelihood value by a lot, the exploration power of the local sampler in other parameters are limited by those which are well measured.
|
|
16
|
+
Currently, we support different step size for different parameters, which you can tune to see whether that improves the situation or not.
|
|
17
|
+
If you know the scale of each parameter ahead of time, reparameterizing them to maintain roughly equal scale across parameters also helps.
|
|
18
|
+
|
|
19
|
+
**My global sample's loss is exploding/not decreasing**
|
|
20
|
+
|
|
21
|
+
This usually means your learning rate used for training the normalizing flow is too large.
|
|
22
|
+
Try reducing the learning rate by a factor of ten.
|
|
23
|
+
|
|
24
|
+
Another reason for a flat loss is your local sampler is not accepting at all.
|
|
25
|
+
This is a bit rarer since this means your data used to train the normalizing flow is just your prior, which the normalizing flow should still be able to learn.
|
|
26
|
+
|
|
27
|
+
**The sampler is stuck a bit until it starts sampling**
|
|
28
|
+
|
|
29
|
+
If you use the option ``Jit`` in constructing the local sampler, the code will compile your code to speed up the execution.
|
|
30
|
+
The sampler is not really stuck, but it is compiling the code. Depending on how you code up your likelihood function, the compilation can take a while.
|
|
31
|
+
If you don't want to wait, you can set ``Jit=False``, which would increase the sampling time.
|
|
32
|
+
|
|
33
|
+
**The compilation is slow**
|
|
34
|
+
|
|
35
|
+
If you have a likelihood with many lines, Jax will take a long time to compile the code.
|
|
36
|
+
Jax is known to be slow in compilation, especially if your computational graph uses some sort of loop that call a function many times.
|
|
37
|
+
While we cannot fundamentally get rid of the problem, [using a jax.lax.scan](https://docs.kidger.site/equinox/tricks/#low-overhead-training-loops) is usually how we deal with it.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Community examples
|
|
2
|
+
|
|
3
|
+
The core design philosophy of flowMC is to stay lean and simple, so we decided to leave most of the use case-specific optimization to the users. Hence, we keep most of the flowMC internals away from most of the users,
|
|
4
|
+
so the only interfaces with flowMC are really defining your likelihood and tuning the sampler parameters exposed on the top level.
|
|
5
|
+
That said, it would be useful to have references to see how to use/tune flowMC for different use cases, therefore in this page we host a number of community examples that are contributed by the users.
|
|
6
|
+
If you find flowMC useful, please consider contributing your example to this page. This will help other users (and perhaps your future students) to get started quickly.
|
|
7
|
+
|
|
8
|
+
## Examples
|
|
9
|
+
|
|
10
|
+
- [jim - A JAX-based gravitational-wave inference toolkit](https://github.com/kazewong/jim)
|
|
11
|
+
- [Bayeux - Stitching together models and samplers](https://github.com/jax-ml/bayeux)
|
|
12
|
+
- [Colab example](https://colab.research.google.com/drive/1-PhneVVik5GUq6w2HlKOsqvus13ZLaBH?usp=sharing)
|
|
13
|
+
- [Markovian Flow Matching: Accelerating MCMC with Continuous Normalizing Flows](https://arxiv.org/pdf/2405.14392)
|