gamrs 0.1.0a1__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.
- gamrs-0.1.0a1/.github/workflows/ci.yml +67 -0
- gamrs-0.1.0a1/.github/workflows/release.yml +129 -0
- gamrs-0.1.0a1/.gitignore +20 -0
- gamrs-0.1.0a1/Cargo.lock +1135 -0
- gamrs-0.1.0a1/Cargo.toml +61 -0
- gamrs-0.1.0a1/LICENSE +21 -0
- gamrs-0.1.0a1/PKG-INFO +150 -0
- gamrs-0.1.0a1/README.md +132 -0
- gamrs-0.1.0a1/benches/bench_baseline.rs +528 -0
- gamrs-0.1.0a1/benches/bench_gaussian.rs +66 -0
- gamrs-0.1.0a1/pyproject.toml +29 -0
- gamrs-0.1.0a1/python/gamrs/__init__.py +67 -0
- gamrs-0.1.0a1/python/gamrs/_coerce.py +0 -0
- gamrs-0.1.0a1/python/gamrs/_fitter.py +705 -0
- gamrs-0.1.0a1/python/gamrs/_low_level.py +280 -0
- gamrs-0.1.0a1/python/gamrs/_persistence.py +103 -0
- gamrs-0.1.0a1/python/gamrs/_predictor.py +218 -0
- gamrs-0.1.0a1/python/gamrs/_stubs.py +77 -0
- gamrs-0.1.0a1/src/basis/cr.rs +451 -0
- gamrs-0.1.0a1/src/basis/mod.rs +13 -0
- gamrs-0.1.0a1/src/basis/re.rs +196 -0
- gamrs-0.1.0a1/src/basis/tensor.rs +472 -0
- gamrs-0.1.0a1/src/design/additive.rs +535 -0
- gamrs-0.1.0a1/src/design/cr.rs +247 -0
- gamrs-0.1.0a1/src/design/mod.rs +244 -0
- gamrs-0.1.0a1/src/design/re.rs +95 -0
- gamrs-0.1.0a1/src/design/tensor.rs +307 -0
- gamrs-0.1.0a1/src/error.rs +15 -0
- gamrs-0.1.0a1/src/family/bernoulli.rs +86 -0
- gamrs-0.1.0a1/src/family/elf.rs +185 -0
- gamrs-0.1.0a1/src/family/gamma.rs +122 -0
- gamrs-0.1.0a1/src/family/gaussian.rs +47 -0
- gamrs-0.1.0a1/src/family/inverse_gaussian.rs +96 -0
- gamrs-0.1.0a1/src/family/link.rs +106 -0
- gamrs-0.1.0a1/src/family/mod.rs +89 -0
- gamrs-0.1.0a1/src/family/negbin.rs +110 -0
- gamrs-0.1.0a1/src/family/ocat.rs +305 -0
- gamrs-0.1.0a1/src/family/poisson.rs +82 -0
- gamrs-0.1.0a1/src/family/quasi.rs +92 -0
- gamrs-0.1.0a1/src/family/tdist.rs +122 -0
- gamrs-0.1.0a1/src/family/tweedie.rs +280 -0
- gamrs-0.1.0a1/src/fit/canonical.rs +321 -0
- gamrs-0.1.0a1/src/fit/driver.rs +286 -0
- gamrs-0.1.0a1/src/fit/family_impls.rs +526 -0
- gamrs-0.1.0a1/src/fit/gaussian.rs +99 -0
- gamrs-0.1.0a1/src/fit/mod.rs +518 -0
- gamrs-0.1.0a1/src/fit/persistence.rs +145 -0
- gamrs-0.1.0a1/src/fit/quantile.rs +199 -0
- gamrs-0.1.0a1/src/inner/armijo.rs +314 -0
- gamrs-0.1.0a1/src/inner/closed_form.rs +182 -0
- gamrs-0.1.0a1/src/inner/gam_fit5.rs +269 -0
- gamrs-0.1.0a1/src/inner/linalg.rs +318 -0
- gamrs-0.1.0a1/src/inner/mod.rs +332 -0
- gamrs-0.1.0a1/src/inner/pirls.rs +603 -0
- gamrs-0.1.0a1/src/lib.rs +48 -0
- gamrs-0.1.0a1/src/outer.rs +308 -0
- gamrs-0.1.0a1/src/python.rs +644 -0
- gamrs-0.1.0a1/src/score/envelope.rs +370 -0
- gamrs-0.1.0a1/src/score/mod.rs +47 -0
- gamrs-0.1.0a1/src/score/profile.rs +146 -0
- gamrs-0.1.0a1/src/score/shape_aware.rs +696 -0
- gamrs-0.1.0a1/src/special.rs +405 -0
- gamrs-0.1.0a1/src/traits.rs +352 -0
- gamrs-0.1.0a1/src/transform.rs +415 -0
- gamrs-0.1.0a1/tests/binomial_smoke.rs +81 -0
- gamrs-0.1.0a1/tests/canonical_api.rs +208 -0
- gamrs-0.1.0a1/tests/diag_low_signal.rs +111 -0
- gamrs-0.1.0a1/tests/family_tests.rs +540 -0
- gamrs-0.1.0a1/tests/fixtures/1d_bernoulli_logit_n1000_k10_cr.json +6779 -0
- gamrs-0.1.0a1/tests/fixtures/1d_bernoulli_logit_n300_k10_cr.json +2579 -0
- gamrs-0.1.0a1/tests/fixtures/1d_gamma_log_n300_k10_cr.json +2584 -0
- gamrs-0.1.0a1/tests/fixtures/1d_gaussian_low_signal_n1000_k10_cr.json +6786 -0
- gamrs-0.1.0a1/tests/fixtures/1d_gaussian_near_linear_n500_k10_cr.json +3787 -0
- gamrs-0.1.0a1/tests/fixtures/1d_gaussian_sigmoid_n300_k10_cr.json +2583 -0
- gamrs-0.1.0a1/tests/fixtures/1d_gaussian_smooth_n1000_k50_cr.json +9303 -0
- gamrs-0.1.0a1/tests/fixtures/1d_gaussian_smooth_n100_k10_cr.json +1383 -0
- gamrs-0.1.0a1/tests/fixtures/1d_gaussian_smooth_n2000_k30_cr.json +13643 -0
- gamrs-0.1.0a1/tests/fixtures/1d_gaussian_smooth_n500_k10_cr.json +3784 -0
- gamrs-0.1.0a1/tests/fixtures/1d_gaussian_sparse_edges_n400_k10_cr.json +3183 -0
- gamrs-0.1.0a1/tests/fixtures/1d_gaussian_step_n500_k10_cr.json +3784 -0
- gamrs-0.1.0a1/tests/fixtures/1d_gaussian_wiggly_n500_k20_cr.json +4115 -0
- gamrs-0.1.0a1/tests/fixtures/1d_invgauss_log_n300_k10_cr.json +2584 -0
- gamrs-0.1.0a1/tests/fixtures/1d_nb_log_n300_k10_cr.json +2583 -0
- gamrs-0.1.0a1/tests/fixtures/1d_poisson_log_n300_k10_cr.json +2579 -0
- gamrs-0.1.0a1/tests/fixtures/1d_quasibinomial_logit_n300_k10_cr.json +2585 -0
- gamrs-0.1.0a1/tests/fixtures/1d_quasipoisson_log_n300_k10_cr.json +2584 -0
- gamrs-0.1.0a1/tests/fixtures/1d_scat_unweighted_n300_k10_cr.json +2589 -0
- gamrs-0.1.0a1/tests/fixtures/1d_tweedie_log_n300_k10_cr.json +2587 -0
- gamrs-0.1.0a1/tests/fixtures/2d_gaussian_additive_n500_k10_cr.json +4699 -0
- gamrs-0.1.0a1/tests/fixtures/2d_gaussian_te_n1000_k5x5.json +8482 -0
- gamrs-0.1.0a1/tests/fixtures/2d_gaussian_te_n300_k5x5.json +3581 -0
- gamrs-0.1.0a1/tests/inner_tests.rs +85 -0
- gamrs-0.1.0a1/tests/parity_additive.rs +129 -0
- gamrs-0.1.0a1/tests/parity_binomial.rs +123 -0
- gamrs-0.1.0a1/tests/parity_gamma.rs +77 -0
- gamrs-0.1.0a1/tests/parity_gaussian.rs +171 -0
- gamrs-0.1.0a1/tests/parity_gaussian_lu.rs +201 -0
- gamrs-0.1.0a1/tests/parity_gaussian_stable.rs +175 -0
- gamrs-0.1.0a1/tests/parity_invgauss.rs +80 -0
- gamrs-0.1.0a1/tests/parity_negbin.rs +75 -0
- gamrs-0.1.0a1/tests/parity_ocat.rs +139 -0
- gamrs-0.1.0a1/tests/parity_poisson.rs +87 -0
- gamrs-0.1.0a1/tests/parity_quasibinomial.rs +90 -0
- gamrs-0.1.0a1/tests/parity_quasipoisson.rs +95 -0
- gamrs-0.1.0a1/tests/parity_re.rs +185 -0
- gamrs-0.1.0a1/tests/parity_scat.rs +105 -0
- gamrs-0.1.0a1/tests/parity_tensor.rs +141 -0
- gamrs-0.1.0a1/tests/parity_tweedie.rs +77 -0
- gamrs-0.1.0a1/tests/persistence_roundtrip.rs +296 -0
- gamrs-0.1.0a1/tests/quantile_smoke.rs +181 -0
- gamrs-0.1.0a1/tests/score_tests.rs +363 -0
- gamrs-0.1.0a1/tests/tdist_smoke.rs +125 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master, main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master, main]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
CARGO_TERM_COLOR: always
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test-linux:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
18
|
+
with:
|
|
19
|
+
components: clippy, rustfmt
|
|
20
|
+
- name: Install OpenBLAS
|
|
21
|
+
run: sudo apt-get update && sudo apt-get install -y libopenblas-dev gfortran
|
|
22
|
+
- name: Cache cargo
|
|
23
|
+
uses: Swatinem/rust-cache@v2
|
|
24
|
+
- name: cargo fmt
|
|
25
|
+
run: cargo fmt --all -- --check
|
|
26
|
+
- name: cargo clippy
|
|
27
|
+
run: cargo clippy --all-targets -- -D warnings
|
|
28
|
+
- name: cargo test (release)
|
|
29
|
+
run: cargo test --release
|
|
30
|
+
|
|
31
|
+
test-python:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
36
|
+
- uses: actions/setup-python@v5
|
|
37
|
+
with:
|
|
38
|
+
python-version: "3.11"
|
|
39
|
+
- name: Install OpenBLAS
|
|
40
|
+
run: sudo apt-get update && sudo apt-get install -y libopenblas-dev gfortran
|
|
41
|
+
- name: Create venv + install deps
|
|
42
|
+
run: |
|
|
43
|
+
python -m venv .venv
|
|
44
|
+
source .venv/bin/activate
|
|
45
|
+
python -m pip install --upgrade pip maturin numpy pandas pytest
|
|
46
|
+
- name: maturin develop
|
|
47
|
+
run: |
|
|
48
|
+
source .venv/bin/activate
|
|
49
|
+
maturin develop --release --features python
|
|
50
|
+
- name: Python smoke test
|
|
51
|
+
run: |
|
|
52
|
+
source .venv/bin/activate
|
|
53
|
+
python -c "
|
|
54
|
+
import numpy as np
|
|
55
|
+
import pandas as pd
|
|
56
|
+
from gamrs import Gam, CrTerm
|
|
57
|
+
rng = np.random.default_rng(0)
|
|
58
|
+
n = 200
|
|
59
|
+
x = rng.uniform(0, 1, n)
|
|
60
|
+
y = np.sin(2 * np.pi * x) + rng.normal(0, 0.2, n)
|
|
61
|
+
df = pd.DataFrame({'x': x, 'y': y})
|
|
62
|
+
g = Gam(terms=[CrTerm('x', k=10)])
|
|
63
|
+
g.fit(df, 'y')
|
|
64
|
+
mu = g.predict(df)
|
|
65
|
+
assert mu.shape == (n,)
|
|
66
|
+
print('python smoke OK')
|
|
67
|
+
"
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
linux:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
target: [x86_64]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.11"
|
|
22
|
+
- name: Build wheels
|
|
23
|
+
uses: PyO3/maturin-action@v1
|
|
24
|
+
env:
|
|
25
|
+
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
|
|
26
|
+
OPENBLAS_STATIC: "1"
|
|
27
|
+
with:
|
|
28
|
+
target: ${{ matrix.target }}
|
|
29
|
+
args: --release --out dist --find-interpreter --no-default-features --features python
|
|
30
|
+
sccache: "true"
|
|
31
|
+
manylinux: auto
|
|
32
|
+
before-script-linux: |
|
|
33
|
+
set -e
|
|
34
|
+
if command -v yum &> /dev/null; then
|
|
35
|
+
yum install -y gcc-gfortran openssl-devel pkgconfig make cmake perl
|
|
36
|
+
else
|
|
37
|
+
apt-get update && apt-get install -y gfortran libssl-dev pkg-config make cmake perl
|
|
38
|
+
fi
|
|
39
|
+
- name: Validate wheel imports
|
|
40
|
+
run: |
|
|
41
|
+
python -m pip install --upgrade pip numpy pytest
|
|
42
|
+
python -m pip install --no-index --find-links dist/ gamrs
|
|
43
|
+
python -c "import gamrs; print(gamrs.__version__ if hasattr(gamrs, '__version__') else 'imported OK')"
|
|
44
|
+
- uses: actions/upload-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: wheels-linux-${{ matrix.target }}
|
|
47
|
+
path: dist
|
|
48
|
+
|
|
49
|
+
macos:
|
|
50
|
+
runs-on: ${{ matrix.runner }}
|
|
51
|
+
strategy:
|
|
52
|
+
fail-fast: false
|
|
53
|
+
matrix:
|
|
54
|
+
include:
|
|
55
|
+
- target: aarch64
|
|
56
|
+
runner: macos-latest
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/checkout@v4
|
|
59
|
+
- uses: actions/setup-python@v5
|
|
60
|
+
with:
|
|
61
|
+
python-version: "3.11"
|
|
62
|
+
- name: Build wheels
|
|
63
|
+
uses: PyO3/maturin-action@v1
|
|
64
|
+
env:
|
|
65
|
+
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
|
|
66
|
+
with:
|
|
67
|
+
target: ${{ matrix.target }}
|
|
68
|
+
args: --release --out dist --find-interpreter --no-default-features --features python
|
|
69
|
+
sccache: "true"
|
|
70
|
+
- uses: actions/upload-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
name: wheels-macos-${{ matrix.target }}
|
|
73
|
+
path: dist
|
|
74
|
+
|
|
75
|
+
windows:
|
|
76
|
+
runs-on: windows-latest
|
|
77
|
+
strategy:
|
|
78
|
+
matrix:
|
|
79
|
+
target: [x64]
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v4
|
|
82
|
+
- uses: actions/setup-python@v5
|
|
83
|
+
with:
|
|
84
|
+
python-version: "3.11"
|
|
85
|
+
architecture: ${{ matrix.target }}
|
|
86
|
+
- name: Build wheels
|
|
87
|
+
uses: PyO3/maturin-action@v1
|
|
88
|
+
env:
|
|
89
|
+
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
|
|
90
|
+
with:
|
|
91
|
+
target: ${{ matrix.target }}
|
|
92
|
+
args: --release --out dist --find-interpreter --no-default-features --features python
|
|
93
|
+
sccache: "true"
|
|
94
|
+
- uses: actions/upload-artifact@v4
|
|
95
|
+
with:
|
|
96
|
+
name: wheels-windows-${{ matrix.target }}
|
|
97
|
+
path: dist
|
|
98
|
+
|
|
99
|
+
sdist:
|
|
100
|
+
runs-on: ubuntu-latest
|
|
101
|
+
steps:
|
|
102
|
+
- uses: actions/checkout@v4
|
|
103
|
+
- name: Build sdist
|
|
104
|
+
uses: PyO3/maturin-action@v1
|
|
105
|
+
with:
|
|
106
|
+
command: sdist
|
|
107
|
+
args: --out dist
|
|
108
|
+
- uses: actions/upload-artifact@v4
|
|
109
|
+
with:
|
|
110
|
+
name: sdist
|
|
111
|
+
path: dist
|
|
112
|
+
|
|
113
|
+
publish-pypi:
|
|
114
|
+
needs: [linux, macos, windows, sdist]
|
|
115
|
+
runs-on: ubuntu-latest
|
|
116
|
+
steps:
|
|
117
|
+
- uses: actions/download-artifact@v4
|
|
118
|
+
with:
|
|
119
|
+
path: dist
|
|
120
|
+
merge-multiple: true
|
|
121
|
+
- name: Publish to PyPI
|
|
122
|
+
uses: PyO3/maturin-action@v1
|
|
123
|
+
env:
|
|
124
|
+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
125
|
+
with:
|
|
126
|
+
command: upload
|
|
127
|
+
args: --non-interactive --skip-existing dist/*
|
|
128
|
+
|
|
129
|
+
# crates.io publish deferred — wire up later. Tracked in TODO.
|
gamrs-0.1.0a1/.gitignore
ADDED