liesel-gam 0.1.0a1__tar.gz → 0.1.1__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.
- liesel_gam-0.1.1/.github/workflows/doctest.yml +61 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/.github/workflows/pre-commit.yml +5 -1
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/.github/workflows/pytest-notebooks.yml +7 -1
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/.github/workflows/pytest-pull.yml +4 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/.github/workflows/pytest.yml +5 -1
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/.gitignore +7 -0
- liesel_gam-0.1.1/.readthedocs.yaml +27 -0
- liesel_gam-0.1.0a1/README.md → liesel_gam-0.1.1/PKG-INFO +38 -7
- liesel_gam-0.1.0a1/PKG-INFO → liesel_gam-0.1.1/README.md +20 -24
- liesel_gam-0.1.1/docs/Makefile +20 -0
- liesel_gam-0.1.1/docs/make.bat +35 -0
- liesel_gam-0.1.1/docs/requirements.txt +156 -0
- liesel_gam-0.1.1/docs/source/_static/custom.css +39 -0
- liesel_gam-0.1.1/docs/source/_static/logo-light.png +0 -0
- liesel_gam-0.1.1/docs/source/_templates/autosummary/attribute.rst +6 -0
- liesel_gam-0.1.1/docs/source/_templates/autosummary/class.rst +55 -0
- liesel_gam-0.1.1/docs/source/_templates/autosummary/function.rst +6 -0
- liesel_gam-0.1.1/docs/source/_templates/autosummary/method.rst +6 -0
- liesel_gam-0.1.1/docs/source/_templates/autosummary/module.rst +68 -0
- liesel_gam-0.1.1/docs/source/conf.py +143 -0
- liesel_gam-0.1.1/docs/source/index.rst +246 -0
- liesel_gam-0.1.1/docs/source/notebooks_composite.rst +10 -0
- liesel_gam-0.1.1/docs/source/notebooks_lin.rst +10 -0
- liesel_gam-0.1.1/docs/source/notebooks_multivariate.rst +10 -0
- liesel_gam-0.1.1/docs/source/notebooks_univariate.rst +10 -0
- liesel_gam-0.1.1/docs/source/plots.png +1 -0
- liesel_gam-0.1.1/docs/source/troubleshooting.md +21 -0
- liesel_gam-0.1.1/docs/source/troubleshooting.rst +2 -0
- liesel_gam-0.1.1/docs/source/welcome.md +30 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/pyproject.toml +7 -0
- liesel_gam-0.1.1/src/liesel_gam/__about__.py +1 -0
- liesel_gam-0.1.1/src/liesel_gam/__init__.py +68 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/src/liesel_gam/basis.py +357 -92
- liesel_gam-0.1.1/src/liesel_gam/basis_builder.py +1865 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/src/liesel_gam/constraint.py +50 -8
- liesel_gam-0.1.1/src/liesel_gam/demo_data.py +114 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/src/liesel_gam/dist.py +318 -24
- liesel_gam-0.1.1/src/liesel_gam/experimental/__init__.py +1 -0
- liesel_gam-0.1.1/src/liesel_gam/experimental/approx_bspline.py +429 -0
- liesel_gam-0.1.1/src/liesel_gam/io.py +132 -0
- liesel_gam-0.1.1/src/liesel_gam/kernel.py +150 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/src/liesel_gam/names.py +12 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/src/liesel_gam/plots.py +242 -2
- liesel_gam-0.1.1/src/liesel_gam/predictor.py +220 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/src/liesel_gam/summary.py +200 -12
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/src/liesel_gam/term.py +477 -195
- liesel_gam-0.1.1/src/liesel_gam/term_builder.py +3213 -0
- liesel_gam-0.1.1/src/liesel_gam/var.py +280 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/uv.lock +545 -0
- liesel_gam-0.1.0a1/src/liesel_gam/__about__.py +0 -1
- liesel_gam-0.1.0a1/src/liesel_gam/__init__.py +0 -49
- liesel_gam-0.1.0a1/src/liesel_gam/basis_builder.py +0 -960
- liesel_gam-0.1.0a1/src/liesel_gam/kernel.py +0 -74
- liesel_gam-0.1.0a1/src/liesel_gam/predictor.py +0 -87
- liesel_gam-0.1.0a1/src/liesel_gam/term_builder.py +0 -1221
- liesel_gam-0.1.0a1/src/liesel_gam/var.py +0 -159
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/.gitattributes +0 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/.github/workflows/pypi.yml +0 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/.pre-commit-config.yaml +0 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/LICENSE +0 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/img/plots.png +0 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/img/plots2.png +0 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/img/plots3.png +0 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/img/s1(x).png +0 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/src/liesel_gam/category_mapping.py +0 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/src/liesel_gam/consolidate_bases.py +0 -0
- {liesel_gam-0.1.0a1 → liesel_gam-0.1.1}/src/liesel_gam/registry.py +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: doctest
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, develop]
|
|
8
|
+
workflow_dispatch: # trigger manually from GitHub UI
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
pytest:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
timeout-minutes: 10
|
|
18
|
+
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
python-version: ["3.13"]
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- name: Check out repository
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
|
+
|
|
27
|
+
- name: Install uv and set the python version
|
|
28
|
+
uses: astral-sh/setup-uv@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: ${{ matrix.python-version }}
|
|
31
|
+
enable-cache: true
|
|
32
|
+
cache-dependency-glob: "uv.lock"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
- name: Set up R
|
|
36
|
+
uses: r-lib/actions/setup-r@v2
|
|
37
|
+
with:
|
|
38
|
+
r-version: 'release'
|
|
39
|
+
use-public-rspm: true
|
|
40
|
+
|
|
41
|
+
- name: Fix R library path
|
|
42
|
+
run: |
|
|
43
|
+
echo "LD_LIBRARY_PATH=$(R RHOME)/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
|
|
44
|
+
|
|
45
|
+
- name: Install R dependencies
|
|
46
|
+
run: |
|
|
47
|
+
Rscript -e "install.packages('arrow')"
|
|
48
|
+
|
|
49
|
+
- name: Install Package
|
|
50
|
+
run: uv sync --locked --group dev
|
|
51
|
+
|
|
52
|
+
- name: Debug R environment
|
|
53
|
+
run: |
|
|
54
|
+
echo "R_HOME=$(R RHOME)"
|
|
55
|
+
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
|
|
56
|
+
find $(R RHOME) -name methods.so
|
|
57
|
+
find $(R RHOME) -name libR.so
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
- name: Run pytest
|
|
61
|
+
run: uv run pytest --doctest-modules src/liesel_gam
|
|
@@ -2,11 +2,15 @@ name: pre-commit
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches: [main
|
|
5
|
+
branches: [main]
|
|
6
6
|
pull_request:
|
|
7
7
|
branches: [main, develop]
|
|
8
8
|
workflow_dispatch: # trigger manually from GitHub UI
|
|
9
9
|
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
10
14
|
jobs:
|
|
11
15
|
pre-commit:
|
|
12
16
|
runs-on: ubuntu-latest
|
|
@@ -2,9 +2,15 @@ name: notebooks
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
5
7
|
branches: [main, develop]
|
|
6
8
|
workflow_dispatch: # trigger manually from GitHub UI
|
|
7
9
|
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
8
14
|
jobs:
|
|
9
15
|
pytest:
|
|
10
16
|
runs-on: ubuntu-latest
|
|
@@ -13,7 +19,7 @@ jobs:
|
|
|
13
19
|
strategy:
|
|
14
20
|
matrix:
|
|
15
21
|
python-version: ["3.13"]
|
|
16
|
-
notebook-dir: ["
|
|
22
|
+
notebook-dir: ["composite", "lin", "multivariate", "univariate"]
|
|
17
23
|
|
|
18
24
|
steps:
|
|
19
25
|
- name: Check out repository
|
|
@@ -2,9 +2,13 @@ name: pytest
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches: [main
|
|
5
|
+
branches: [main]
|
|
6
6
|
workflow_dispatch: # trigger manually from GitHub UI
|
|
7
7
|
|
|
8
|
+
concurrency:
|
|
9
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
8
12
|
jobs:
|
|
9
13
|
pytest:
|
|
10
14
|
runs-on: ubuntu-latest
|
|
@@ -180,3 +180,10 @@ notebooks/test_ti_smooth.ipynb
|
|
|
180
180
|
notebooks/test_mrf.R
|
|
181
181
|
img/Präsentation1.pptx
|
|
182
182
|
covtest.sh
|
|
183
|
+
/docs/source/generated
|
|
184
|
+
notebooks/multivariate/test_tx_optim.ipynb
|
|
185
|
+
/doctests
|
|
186
|
+
notebooks/univariate/test_ps_nosmooth.ipynb
|
|
187
|
+
notebooks/univariate/test_ps_smooth_constant_prior.ipynb
|
|
188
|
+
notebooks/univariate/test_ps_vi.ipynb
|
|
189
|
+
notebooks/univariate/test_ps_with_optim.ipynb
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Read the Docs configuration file
|
|
2
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
3
|
+
|
|
4
|
+
# Required
|
|
5
|
+
version: 2
|
|
6
|
+
|
|
7
|
+
# Set the OS, Python version, and other tools you might need
|
|
8
|
+
build:
|
|
9
|
+
os: ubuntu-24.04
|
|
10
|
+
tools:
|
|
11
|
+
python: "3.13"
|
|
12
|
+
jobs:
|
|
13
|
+
install:
|
|
14
|
+
- python -m pip install --upgrade pip
|
|
15
|
+
- python -m pip install . --group dev
|
|
16
|
+
- python -m pip list
|
|
17
|
+
|
|
18
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
19
|
+
sphinx:
|
|
20
|
+
configuration: docs/source/conf.py
|
|
21
|
+
|
|
22
|
+
# Optionally, but recommended,
|
|
23
|
+
# declare the Python requirements required to build your documentation
|
|
24
|
+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
25
|
+
# python:
|
|
26
|
+
# install:
|
|
27
|
+
# - requirements: docs/requirements.txt
|
|
@@ -1,9 +1,29 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: liesel_gam
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Functionality for Generalized Additive Models in Liesel
|
|
5
|
+
Author: Johannes Brachem
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: machine-learning,statistics
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Requires-Python: <3.14,>=3.13
|
|
13
|
+
Requires-Dist: formulaic>=1.2.1
|
|
14
|
+
Requires-Dist: liesel>=0.4.2
|
|
15
|
+
Requires-Dist: plotnine>=0.14.5
|
|
16
|
+
Requires-Dist: smoothcon>=0.0.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
1
19
|
# Bayesian Generalized Additive Models in Liesel
|
|
2
20
|
|
|
3
21
|
[](https://pypi.org/project/liesel_gam)
|
|
22
|
+
[](https://liesel-gam.readthedocs.io/latest/)
|
|
4
23
|
[](https://github.com/liesel-devs/liesel_gam/actions/workflows/pre-commit.yml)
|
|
5
24
|
[](https://github.com/liesel-devs/liesel_gam/tree/main/notebooks)
|
|
6
25
|
[](https://github.com/liesel-devs/liesel_gam/actions/workflows/pytest.yml)
|
|
26
|
+
[](https://github.com/liesel-devs/liesel_gam/actions/workflows/doctest.yml)
|
|
7
27
|
[](https://github.com/liesel-devs/liesel_gam/actions/workflows/pytest.yml)
|
|
8
28
|
|
|
9
29
|
This title is short and catchy, but does not convey the full range of models covered by this library. We could also say:
|
|
@@ -78,6 +98,13 @@ You can also install the development version from GitHub via pip:
|
|
|
78
98
|
pip install git+https://github.com/liesel-devs/liesel_gam.git
|
|
79
99
|
```
|
|
80
100
|
|
|
101
|
+
Since liesel-GAM interfaces with R via `ryp` under the hood,
|
|
102
|
+
you also need the R packages `{arrow}` and `{svglite}` to be available on your system:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
Rscript -e "install.packages(c('arrow', 'svglite'))"
|
|
106
|
+
```
|
|
107
|
+
|
|
81
108
|
## Contents
|
|
82
109
|
|
|
83
110
|
- [Short usage illustration](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#illustrations)
|
|
@@ -91,7 +118,7 @@ pip install git+https://github.com/liesel-devs/liesel_gam.git
|
|
|
91
118
|
- [Compose terms to build new models](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#compose-terms-to-build-new-models)
|
|
92
119
|
- [Use a custom basis function](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#use-a-custom-basis-function)
|
|
93
120
|
- [Use a custom basis matrix directly](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#use-a-custom-basis-matrix-directly)
|
|
94
|
-
- [
|
|
121
|
+
- [Partially standardized parameterization](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#factor_scale-parameterization)
|
|
95
122
|
- [Extract a basis](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#extract-a-basis-directly)
|
|
96
123
|
- [Extract a column from the data frame as a variable](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#extract-a-column-from-the-data-frame-as-a-variable)
|
|
97
124
|
- [Overview of smooth terms available in liesel_gam](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#overview-of-smooth-terms-available-in-liesel_gam)
|
|
@@ -436,23 +463,27 @@ new_custom_basis = ... # your (m, p) array, the basis matrix at which you want t
|
|
|
436
463
|
model.predict(newdata={"x8": new_custom_basis}, predict=["h(x8)"])
|
|
437
464
|
```
|
|
438
465
|
|
|
439
|
-
###
|
|
466
|
+
### Partially standardized parameterization
|
|
440
467
|
|
|
441
468
|
Sometimes sampling from the posterior can be facilitated by sampling from a
|
|
442
|
-
reparameterized model, particularly using a
|
|
443
|
-
(see [Stan documentation](https://mc-stan.org/docs/2_18/stan-users-guide/reparameterization-section.html)).
|
|
469
|
+
reparameterized model, particularly using a partially standardized parameterization.
|
|
444
470
|
|
|
445
|
-
Consider the mdoel $x \sim N(0, \sigma^2)$.
|
|
471
|
+
Consider the mdoel $x \sim N(0, \sigma^2)$. factor_scale parameterization means that,
|
|
446
472
|
instead of sampling $x$ and $\sigma^2$ directly, we rewrite it as $x = \sigma * \tilde{x}$,
|
|
447
473
|
where $\tilde{x} \sim N(0, 1)$, and draw samples of $\tilde{x}$ and $\sigma^2$.
|
|
448
474
|
|
|
449
|
-
For many terms in `liesel_gam` you can enable a
|
|
475
|
+
For many terms in `liesel_gam` you can enable a partially standardized parameterization
|
|
476
|
+
by
|
|
450
477
|
setting a corresponding argument to `True`:
|
|
451
478
|
|
|
452
479
|
```python
|
|
453
|
-
loc_pred += tb.ps("x5", k=20,
|
|
480
|
+
loc_pred += tb.ps("x5", k=20, factor_scale=True)
|
|
454
481
|
```
|
|
455
482
|
|
|
483
|
+
When used with diagonalized penalties (the default), setting `factor_scale=True`
|
|
484
|
+
corresponds to a "noncentered parameterization"
|
|
485
|
+
(see [Stan documentation](https://mc-stan.org/docs/2_18/stan-users-guide/reparameterization-section.html))
|
|
486
|
+
|
|
456
487
|
### Extract a basis directly
|
|
457
488
|
|
|
458
489
|
Sometimes you just want a certain basis matrix, and use it to build your own term.
|
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: liesel_gam
|
|
3
|
-
Version: 0.1.0a1
|
|
4
|
-
Summary: Functionality for Generalized Additive Models in Liesel
|
|
5
|
-
Author: Johannes Brachem
|
|
6
|
-
License-File: LICENSE
|
|
7
|
-
Keywords: machine-learning,statistics
|
|
8
|
-
Classifier: Intended Audience :: Science/Research
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
-
Requires-Python: <3.14,>=3.13
|
|
13
|
-
Requires-Dist: formulaic>=1.2.1
|
|
14
|
-
Requires-Dist: liesel>=0.4.2
|
|
15
|
-
Requires-Dist: smoothcon>=0.0.9
|
|
16
|
-
Description-Content-Type: text/markdown
|
|
17
|
-
|
|
18
1
|
# Bayesian Generalized Additive Models in Liesel
|
|
19
2
|
|
|
20
3
|
[](https://pypi.org/project/liesel_gam)
|
|
4
|
+
[](https://liesel-gam.readthedocs.io/latest/)
|
|
21
5
|
[](https://github.com/liesel-devs/liesel_gam/actions/workflows/pre-commit.yml)
|
|
22
6
|
[](https://github.com/liesel-devs/liesel_gam/tree/main/notebooks)
|
|
23
7
|
[](https://github.com/liesel-devs/liesel_gam/actions/workflows/pytest.yml)
|
|
8
|
+
[](https://github.com/liesel-devs/liesel_gam/actions/workflows/doctest.yml)
|
|
24
9
|
[](https://github.com/liesel-devs/liesel_gam/actions/workflows/pytest.yml)
|
|
25
10
|
|
|
26
11
|
This title is short and catchy, but does not convey the full range of models covered by this library. We could also say:
|
|
@@ -95,6 +80,13 @@ You can also install the development version from GitHub via pip:
|
|
|
95
80
|
pip install git+https://github.com/liesel-devs/liesel_gam.git
|
|
96
81
|
```
|
|
97
82
|
|
|
83
|
+
Since liesel-GAM interfaces with R via `ryp` under the hood,
|
|
84
|
+
you also need the R packages `{arrow}` and `{svglite}` to be available on your system:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
Rscript -e "install.packages(c('arrow', 'svglite'))"
|
|
88
|
+
```
|
|
89
|
+
|
|
98
90
|
## Contents
|
|
99
91
|
|
|
100
92
|
- [Short usage illustration](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#illustrations)
|
|
@@ -108,7 +100,7 @@ pip install git+https://github.com/liesel-devs/liesel_gam.git
|
|
|
108
100
|
- [Compose terms to build new models](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#compose-terms-to-build-new-models)
|
|
109
101
|
- [Use a custom basis function](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#use-a-custom-basis-function)
|
|
110
102
|
- [Use a custom basis matrix directly](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#use-a-custom-basis-matrix-directly)
|
|
111
|
-
- [
|
|
103
|
+
- [Partially standardized parameterization](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#factor_scale-parameterization)
|
|
112
104
|
- [Extract a basis](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#extract-a-basis-directly)
|
|
113
105
|
- [Extract a column from the data frame as a variable](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#extract-a-column-from-the-data-frame-as-a-variable)
|
|
114
106
|
- [Overview of smooth terms available in liesel_gam](https://github.com/liesel-devs/liesel_gam?tab=readme-ov-file#overview-of-smooth-terms-available-in-liesel_gam)
|
|
@@ -453,23 +445,27 @@ new_custom_basis = ... # your (m, p) array, the basis matrix at which you want t
|
|
|
453
445
|
model.predict(newdata={"x8": new_custom_basis}, predict=["h(x8)"])
|
|
454
446
|
```
|
|
455
447
|
|
|
456
|
-
###
|
|
448
|
+
### Partially standardized parameterization
|
|
457
449
|
|
|
458
450
|
Sometimes sampling from the posterior can be facilitated by sampling from a
|
|
459
|
-
reparameterized model, particularly using a
|
|
460
|
-
(see [Stan documentation](https://mc-stan.org/docs/2_18/stan-users-guide/reparameterization-section.html)).
|
|
451
|
+
reparameterized model, particularly using a partially standardized parameterization.
|
|
461
452
|
|
|
462
|
-
Consider the mdoel $x \sim N(0, \sigma^2)$.
|
|
453
|
+
Consider the mdoel $x \sim N(0, \sigma^2)$. factor_scale parameterization means that,
|
|
463
454
|
instead of sampling $x$ and $\sigma^2$ directly, we rewrite it as $x = \sigma * \tilde{x}$,
|
|
464
455
|
where $\tilde{x} \sim N(0, 1)$, and draw samples of $\tilde{x}$ and $\sigma^2$.
|
|
465
456
|
|
|
466
|
-
For many terms in `liesel_gam` you can enable a
|
|
457
|
+
For many terms in `liesel_gam` you can enable a partially standardized parameterization
|
|
458
|
+
by
|
|
467
459
|
setting a corresponding argument to `True`:
|
|
468
460
|
|
|
469
461
|
```python
|
|
470
|
-
loc_pred += tb.ps("x5", k=20,
|
|
462
|
+
loc_pred += tb.ps("x5", k=20, factor_scale=True)
|
|
471
463
|
```
|
|
472
464
|
|
|
465
|
+
When used with diagonalized penalties (the default), setting `factor_scale=True`
|
|
466
|
+
corresponds to a "noncentered parameterization"
|
|
467
|
+
(see [Stan documentation](https://mc-stan.org/docs/2_18/stan-users-guide/reparameterization-section.html))
|
|
468
|
+
|
|
473
469
|
### Extract a basis directly
|
|
474
470
|
|
|
475
471
|
Sometimes you just want a certain basis matrix, and use it to build your own term.
|
|
@@ -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 = source
|
|
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)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
absl-py==2.2.2
|
|
2
|
+
accessible-pygments==0.0.5
|
|
3
|
+
alabaster==1.0.0
|
|
4
|
+
appnope==0.1.4
|
|
5
|
+
arviz==0.21.0
|
|
6
|
+
asttokens==3.0.0
|
|
7
|
+
attrs==25.3.0
|
|
8
|
+
babel==2.17.0
|
|
9
|
+
beautifulsoup4==4.13.4
|
|
10
|
+
black==25.1.0
|
|
11
|
+
blackjax==1.2.5
|
|
12
|
+
build==1.2.2.post1
|
|
13
|
+
certifi==2025.4.26
|
|
14
|
+
cfgv==3.4.0
|
|
15
|
+
charset-normalizer==3.4.2
|
|
16
|
+
chex==0.1.89
|
|
17
|
+
click==8.2.0
|
|
18
|
+
cloudpickle==3.1.1
|
|
19
|
+
comm==0.2.2
|
|
20
|
+
contourpy==1.3.2
|
|
21
|
+
coverage==7.8.0
|
|
22
|
+
cycler==0.12.1
|
|
23
|
+
debugpy==1.8.14
|
|
24
|
+
decorator==5.2.1
|
|
25
|
+
dill==0.4.0
|
|
26
|
+
distlib==0.3.9
|
|
27
|
+
dm-tree==0.1.9
|
|
28
|
+
docutils==0.21.2
|
|
29
|
+
etils==1.12.2
|
|
30
|
+
executing==2.2.0
|
|
31
|
+
fastjsonschema==2.21.1
|
|
32
|
+
fastprogress==1.0.3
|
|
33
|
+
filelock==3.18.0
|
|
34
|
+
flake8==7.2.0
|
|
35
|
+
fonttools==4.58.0
|
|
36
|
+
gast==0.6.0
|
|
37
|
+
h5netcdf==1.6.1
|
|
38
|
+
h5py==3.13.0
|
|
39
|
+
identify==2.6.10
|
|
40
|
+
idna==3.10
|
|
41
|
+
imagesize==1.4.1
|
|
42
|
+
importlib_metadata==8.7.0
|
|
43
|
+
iniconfig==2.1.0
|
|
44
|
+
ipykernel==6.29.5
|
|
45
|
+
ipython==9.2.0
|
|
46
|
+
ipython_pygments_lexers==1.1.1
|
|
47
|
+
isort==6.0.1
|
|
48
|
+
jax==0.6.0
|
|
49
|
+
jaxlib==0.6.0
|
|
50
|
+
jaxopt==0.8.5
|
|
51
|
+
jedi==0.19.2
|
|
52
|
+
Jinja2==3.1.6
|
|
53
|
+
joblib==1.5.0
|
|
54
|
+
jsonschema==4.23.0
|
|
55
|
+
jsonschema-specifications==2025.4.1
|
|
56
|
+
jupyter-cache==1.0.1
|
|
57
|
+
jupyter_client==8.6.3
|
|
58
|
+
jupyter_core==5.7.2
|
|
59
|
+
kiwisolver==1.4.8
|
|
60
|
+
git+https://github.com/liesel-devs/liesel.git#egg=liesel
|
|
61
|
+
git+https://github.com/liesel-devs/liesel_gam.git#egg=liesel_gam
|
|
62
|
+
markdown-it-py==3.0.0
|
|
63
|
+
MarkupSafe==3.0.2
|
|
64
|
+
matplotlib==3.10.3
|
|
65
|
+
matplotlib-inline==0.1.7
|
|
66
|
+
mccabe==0.7.0
|
|
67
|
+
mdit-py-plugins==0.4.2
|
|
68
|
+
mdurl==0.1.2
|
|
69
|
+
mizani==0.13.5
|
|
70
|
+
ml_dtypes==0.5.1
|
|
71
|
+
mypy==1.15.0
|
|
72
|
+
mypy_extensions==1.1.0
|
|
73
|
+
myst-nb==1.2.0
|
|
74
|
+
myst-parser==4.0.1
|
|
75
|
+
nbclient==0.10.2
|
|
76
|
+
nbformat==5.10.4
|
|
77
|
+
nest-asyncio==1.6.0
|
|
78
|
+
networkx==3.4.2
|
|
79
|
+
nodeenv==1.9.1
|
|
80
|
+
numpy==2.2.1
|
|
81
|
+
opt_einsum==3.4.0
|
|
82
|
+
optax==0.2.4
|
|
83
|
+
packaging==25.0
|
|
84
|
+
pandas==2.2.3
|
|
85
|
+
parso==0.8.4
|
|
86
|
+
pathspec==0.12.1
|
|
87
|
+
patsy==1.0.1
|
|
88
|
+
pdoc==15.0.3
|
|
89
|
+
pexpect==4.9.0
|
|
90
|
+
pillow==11.2.1
|
|
91
|
+
platformdirs==4.3.8
|
|
92
|
+
plotnine==0.14.5
|
|
93
|
+
pluggy==1.6.0
|
|
94
|
+
pre_commit==4.2.0
|
|
95
|
+
prompt_toolkit==3.0.51
|
|
96
|
+
psutil==7.0.0
|
|
97
|
+
ptyprocess==0.7.0
|
|
98
|
+
pure_eval==0.2.3
|
|
99
|
+
pycodestyle==2.13.0
|
|
100
|
+
pydata-sphinx-theme==0.15.4
|
|
101
|
+
pydot==4.0.0
|
|
102
|
+
pyflakes==3.3.2
|
|
103
|
+
Pygments==2.19.1
|
|
104
|
+
pyparsing==3.2.3
|
|
105
|
+
pyproject_hooks==1.2.0
|
|
106
|
+
pytest==8.3.5
|
|
107
|
+
pytest-cov==6.1.1
|
|
108
|
+
python-dateutil==2.9.0.post0
|
|
109
|
+
python-dotenv==1.0.1
|
|
110
|
+
pytz==2025.2
|
|
111
|
+
pyupgrade==3.19.1
|
|
112
|
+
PyYAML==6.0.2
|
|
113
|
+
pyzmq==26.4.0
|
|
114
|
+
referencing==0.36.2
|
|
115
|
+
requests==2.32.3
|
|
116
|
+
roman-numerals-py==3.1.0
|
|
117
|
+
rpds-py==0.25.0
|
|
118
|
+
ruff==0.11.8
|
|
119
|
+
scikit-learn==1.6.1
|
|
120
|
+
scipy==1.14.1
|
|
121
|
+
seaborn==0.13.2
|
|
122
|
+
setuptools==80.7.1
|
|
123
|
+
six==1.17.0
|
|
124
|
+
snowballstemmer==3.0.1
|
|
125
|
+
soupsieve==2.7
|
|
126
|
+
Sphinx==8.2.3
|
|
127
|
+
sphinx-autodoc-typehints==3.2.0
|
|
128
|
+
sphinx-book-theme==1.1.4
|
|
129
|
+
sphinx-copybutton==0.5.2
|
|
130
|
+
sphinx-remove-toctrees==1.0.0.post1
|
|
131
|
+
sphinxcontrib-applehelp==2.0.0
|
|
132
|
+
sphinxcontrib-devhelp==2.0.0
|
|
133
|
+
sphinxcontrib-htmlhelp==2.1.0
|
|
134
|
+
sphinxcontrib-jsmath==1.0.1
|
|
135
|
+
sphinxcontrib-qthelp==2.0.0
|
|
136
|
+
sphinxcontrib-serializinghtml==2.0.0
|
|
137
|
+
SQLAlchemy==2.0.41
|
|
138
|
+
stack-data==0.6.3
|
|
139
|
+
statsmodels==0.14.4
|
|
140
|
+
tabulate==0.9.0
|
|
141
|
+
tensorflow-probability==0.25.0
|
|
142
|
+
threadpoolctl==3.6.0
|
|
143
|
+
tokenize_rt==6.1.0
|
|
144
|
+
toolz==1.0.0
|
|
145
|
+
tornado==6.5
|
|
146
|
+
tqdm==4.67.1
|
|
147
|
+
traitlets==5.14.3
|
|
148
|
+
typing_extensions==4.13.2
|
|
149
|
+
tzdata==2025.2
|
|
150
|
+
urllib3==2.4.0
|
|
151
|
+
virtualenv==20.31.2
|
|
152
|
+
wcwidth==0.2.13
|
|
153
|
+
wrapt==1.17.2
|
|
154
|
+
xarray==2025.4.0
|
|
155
|
+
xarray-einstats==0.8.0
|
|
156
|
+
zipp==3.21.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#acknowledgements img {
|
|
2
|
+
height: 4em;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* uni goettingen */
|
|
6
|
+
#acknowledgements img:first-of-type {
|
|
7
|
+
margin: 1em 2em 1em 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* dfg */
|
|
11
|
+
#acknowledgements img:nth-of-type(2) {
|
|
12
|
+
margin: 1em 0 1em 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* override no-wrap for inherited kwargs tables */
|
|
16
|
+
.wy-table-responsive table td, .wy-table-responsive table th {
|
|
17
|
+
white-space: normal;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
p.rubric {
|
|
21
|
+
border-bottom: 0em;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* from https://stackoverflow.com/a/62451601 */
|
|
25
|
+
table.dataframe {
|
|
26
|
+
display: block;
|
|
27
|
+
max-width: -moz-fit-content;
|
|
28
|
+
max-width: fit-content;
|
|
29
|
+
overflow-x: auto;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
table.dataframe th, table.dataframe td {
|
|
33
|
+
border: 1px solid #c9c9c9;
|
|
34
|
+
padding: 6px 13px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
table.dataframe tr:nth-child(even) {
|
|
38
|
+
background-color: #fafafa;
|
|
39
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{{ name | escape | underline }}
|
|
2
|
+
|
|
3
|
+
.. currentmodule:: {{ module }}
|
|
4
|
+
|
|
5
|
+
.. autoclass:: {{ objname }}
|
|
6
|
+
:show-inheritance:
|
|
7
|
+
|
|
8
|
+
{% block methods %}
|
|
9
|
+
|
|
10
|
+
{% set public_methods = [] %}
|
|
11
|
+
{% for item in methods %}
|
|
12
|
+
{% if not (item == "__init__"
|
|
13
|
+
or item in inherited_members
|
|
14
|
+
or item == "cross_entropy"
|
|
15
|
+
or item == "kl_divergence") %}
|
|
16
|
+
{% set _ = public_methods.append(item) %}
|
|
17
|
+
{% endif %}
|
|
18
|
+
{% endfor %}
|
|
19
|
+
|
|
20
|
+
{% if public_methods %}
|
|
21
|
+
.. rubric:: {{ _('Methods') }}
|
|
22
|
+
|
|
23
|
+
.. autosummary::
|
|
24
|
+
:toctree:
|
|
25
|
+
:nosignatures:
|
|
26
|
+
|
|
27
|
+
{% for item in public_methods %}
|
|
28
|
+
~{{ name }}.{{ item }}
|
|
29
|
+
{% endfor %}
|
|
30
|
+
{% endif %}
|
|
31
|
+
|
|
32
|
+
{% endblock %}
|
|
33
|
+
|
|
34
|
+
{% block attributes %}
|
|
35
|
+
|
|
36
|
+
{% set public_attributes = [] %}
|
|
37
|
+
{% for item in attributes %}
|
|
38
|
+
{% if item not in inherited_members %}
|
|
39
|
+
{% set _ = public_attributes.append(item) %}
|
|
40
|
+
{% endif %}
|
|
41
|
+
{% endfor %}
|
|
42
|
+
|
|
43
|
+
{% if public_attributes %}
|
|
44
|
+
.. rubric:: {{ _('Attributes') }}
|
|
45
|
+
|
|
46
|
+
.. autosummary::
|
|
47
|
+
:template: autosummary/attribute.rst
|
|
48
|
+
:toctree:
|
|
49
|
+
|
|
50
|
+
{% for item in public_attributes %}
|
|
51
|
+
~{{ name }}.{{ item }}
|
|
52
|
+
{% endfor %}
|
|
53
|
+
{% endif %}
|
|
54
|
+
|
|
55
|
+
{% endblock %}
|