gpjax 0.9.0__py3-none-any.whl → 0.9.2__py3-none-any.whl

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.
gpjax/__init__.py CHANGED
@@ -40,7 +40,7 @@ __license__ = "MIT"
40
40
  __description__ = "Didactic Gaussian processes in JAX"
41
41
  __url__ = "https://github.com/JaxGaussianProcesses/GPJax"
42
42
  __contributors__ = "https://github.com/JaxGaussianProcesses/GPJax/graphs/contributors"
43
- __version__ = "0.9.0"
43
+ __version__ = "0.9.2"
44
44
 
45
45
  __all__ = [
46
46
  "base",
@@ -139,12 +139,7 @@ class LogarithmicGoldsteinPrice(AbstractContinuousTestFunction):
139
139
  x1 = 4.0 * x[:, 0] - 2.0
140
140
  x2 = 4.0 * x[:, 1] - 2.0
141
141
  a = 1.0 + (x1 + x2 + 1.0) ** 2 * (
142
- 19.0
143
- - 14.0 * x1
144
- + 3.0 * (x1**2)
145
- - 14.0 * x2
146
- + 6.0 * x1 * x2
147
- + 3.0 * (x2**2)
142
+ 19.0 - 14.0 * x1 + 3.0 * (x1**2) - 14.0 * x2 + 6.0 * x1 * x2 + 3.0 * (x2**2)
148
143
  )
149
144
  b = 30.0 + (2.0 * x1 - 3.0 * x2) ** 2 * (
150
145
  18.0
gpjax/distributions.py CHANGED
@@ -162,9 +162,7 @@ class GaussianDistribution(tfd.Distribution):
162
162
 
163
163
  return vmap(affine_transformation)(Z)
164
164
 
165
- def sample(
166
- self, seed: KeyArray, sample_shape: Tuple[int, ...]
167
- ): # pylint: disable=useless-super-delegation
165
+ def sample(self, seed: KeyArray, sample_shape: Tuple[int, ...]): # pylint: disable=useless-super-delegation
168
166
  r"""See `Distribution.sample`."""
169
167
  return self._sample_n(
170
168
  seed, sample_shape[0]
gpjax/gps.py CHANGED
@@ -17,6 +17,7 @@ from abc import abstractmethod
17
17
 
18
18
  import beartype.typing as tp
19
19
  from cola.annotations import PSD
20
+ from cola.linalg.algorithm_base import Algorithm
20
21
  from cola.linalg.decompositions.decompositions import Cholesky
21
22
  from cola.linalg.inverse.inv import solve
22
23
  from cola.ops.operators import I_like
@@ -146,20 +147,17 @@ class Prior(AbstractPrior[M, K]):
146
147
  if tp.TYPE_CHECKING:
147
148
 
148
149
  @tp.overload
149
- def __mul__(self, other: GL) -> "ConjugatePosterior[Prior[M, K], GL]":
150
- ...
150
+ def __mul__(self, other: GL) -> "ConjugatePosterior[Prior[M, K], GL]": ...
151
151
 
152
152
  @tp.overload
153
153
  def __mul__( # noqa: F811
154
154
  self, other: NGL
155
- ) -> "NonConjugatePosterior[Prior[M, K], NGL]":
156
- ...
155
+ ) -> "NonConjugatePosterior[Prior[M, K], NGL]": ...
157
156
 
158
157
  @tp.overload
159
158
  def __mul__( # noqa: F811
160
159
  self, other: L
161
- ) -> "AbstractPosterior[Prior[M, K], L]":
162
- ...
160
+ ) -> "AbstractPosterior[Prior[M, K], L]": ...
163
161
 
164
162
  def __mul__(self, other): # noqa: F811
165
163
  r"""Combine the prior with a likelihood to form a posterior distribution.
@@ -195,20 +193,17 @@ class Prior(AbstractPrior[M, K]):
195
193
  if tp.TYPE_CHECKING:
196
194
 
197
195
  @tp.overload
198
- def __rmul__(self, other: GL) -> "ConjugatePosterior[Prior[M, K], GL]":
199
- ...
196
+ def __rmul__(self, other: GL) -> "ConjugatePosterior[Prior[M, K], GL]": ...
200
197
 
201
198
  @tp.overload
202
199
  def __rmul__( # noqa: F811
203
200
  self, other: NGL
204
- ) -> "NonConjugatePosterior[Prior[M, K], NGL]":
205
- ...
201
+ ) -> "NonConjugatePosterior[Prior[M, K], NGL]": ...
206
202
 
207
203
  @tp.overload
208
204
  def __rmul__( # noqa: F811
209
205
  self, other: L
210
- ) -> "AbstractPosterior[Prior[M, K], L]":
211
- ...
206
+ ) -> "AbstractPosterior[Prior[M, K], L]": ...
212
207
 
213
208
  def __rmul__(self, other): # noqa: F811
214
209
  r"""Combine the prior with a likelihood to form a posterior distribution.
@@ -536,6 +531,7 @@ class ConjugatePosterior(AbstractPosterior[P, GL]):
536
531
  train_data: Dataset,
537
532
  key: KeyArray,
538
533
  num_features: int | None = 100,
534
+ solver_algorithm: tp.Optional[Algorithm] = Cholesky(),
539
535
  ) -> FunctionalSample:
540
536
  r"""Draw approximate samples from the Gaussian process posterior.
541
537
 
@@ -569,6 +565,11 @@ class ConjugatePosterior(AbstractPosterior[P, GL]):
569
565
  key (KeyArray): The random seed used for the sample(s).
570
566
  num_features (int): The number of features used when approximating the
571
567
  kernel.
568
+ solver_algorithm (Optional[Algorithm], optional): The algorithm to use for the solves of
569
+ the inverse of the covariance matrix. See the
570
+ [CoLA documentation](https://cola.readthedocs.io/en/latest/package/cola.linalg.html#algorithms)
571
+ for which solver to pick. For PSD matrices, CoLA currently recommends Cholesky() for small
572
+ matrices and CG() for larger matrices. Select Auto() to let CoLA decide. Defaults to Cholesky().
572
573
 
573
574
  Returns:
574
575
  FunctionalSample: A function representing an approximate sample from the Gaussian
@@ -594,7 +595,7 @@ class ConjugatePosterior(AbstractPosterior[P, GL]):
594
595
  canonical_weights = solve(
595
596
  Sigma,
596
597
  y + eps - jnp.inner(Phi, fourier_weights),
597
- Cholesky(),
598
+ solver_algorithm,
598
599
  ) # [N, B]
599
600
 
600
601
  def sample_fn(test_inputs: Float[Array, "n D"]) -> Float[Array, "n B"]:
@@ -722,15 +723,13 @@ class NonConjugatePosterior(AbstractPosterior[P, NGL]):
722
723
 
723
724
 
724
725
  @tp.overload
725
- def construct_posterior(prior: P, likelihood: GL) -> ConjugatePosterior[P, GL]:
726
- ...
726
+ def construct_posterior(prior: P, likelihood: GL) -> ConjugatePosterior[P, GL]: ...
727
727
 
728
728
 
729
729
  @tp.overload
730
730
  def construct_posterior( # noqa: F811
731
731
  prior: P, likelihood: NGL
732
- ) -> NonConjugatePosterior[P, NGL]:
733
- ...
732
+ ) -> NonConjugatePosterior[P, NGL]: ...
734
733
 
735
734
 
736
735
  def construct_posterior(prior, likelihood): # noqa: F811
@@ -1,4 +1,5 @@
1
- """Compute Random Fourier Feature (RFF) kernel approximations. """
1
+ """Compute Random Fourier Feature (RFF) kernel approximations."""
2
+
2
3
  import beartype.typing as tp
3
4
  import jax.random as jr
4
5
  from jaxtyping import Float
@@ -74,8 +74,7 @@ class AbstractKernelComputation:
74
74
  @abc.abstractmethod
75
75
  def _cross_covariance(
76
76
  self, kernel: K, x: Num[Array, "N D"], y: Num[Array, "M D"]
77
- ) -> Float[Array, "N M"]:
78
- ...
77
+ ) -> Float[Array, "N M"]: ...
79
78
 
80
79
  def cross_covariance(
81
80
  self, kernel: K, x: Num[Array, "N D"], y: Num[Array, "M D"]
@@ -26,7 +26,8 @@ from gpjax.kernels.computations.base import AbstractKernelComputation
26
26
  from gpjax.typing import Array
27
27
 
28
28
  Kernel = tp.TypeVar(
29
- "Kernel", bound="gpjax.kernels.non_euclidean.graph.GraphKernel" # noqa: F821
29
+ "Kernel",
30
+ bound="gpjax.kernels.non_euclidean.graph.GraphKernel", # noqa: F821
30
31
  )
31
32
 
32
33
 
@@ -38,6 +38,7 @@ class Matern12(StationaryKernel):
38
38
  k(x, y) = \sigma^2\exp\Bigg(-\frac{\lvert x-y \rvert}{2\ell^2}\Bigg)
39
39
  $$
40
40
  """
41
+
41
42
  name: str = "Matérn12"
42
43
 
43
44
  def __call__(self, x: Float[Array, " D"], y: Float[Array, " D"]) -> ScalarFloat:
@@ -1,36 +1,39 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: gpjax
3
- Version: 0.9.0
3
+ Version: 0.9.2
4
4
  Summary: Gaussian processes in JAX.
5
- Home-page: https://github.com/JaxGaussianProcesses/GPJax
6
- License: Apache-2.0
5
+ Project-URL: Documentation, https://docs.jaxgaussianprocesses.com/
6
+ Project-URL: Issues, https://github.com/JaxGaussianProcesses/GPJax/issues
7
+ Project-URL: Source, https://github.com/JaxGaussianProcesses/GPJax
8
+ Author-email: Thomas Pinder <tompinder@live.co.uk>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
7
11
  Keywords: gaussian-processes jax machine-learning bayesian
8
- Author: Thomas Pinder
9
- Author-email: tompinder@live.co.uk
10
- Requires-Python: >=3.10,<3.12
11
- Classifier: License :: OSI Approved :: Apache Software License
12
- Classifier: Programming Language :: Python :: 3
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Programming Language :: Python
13
14
  Classifier: Programming Language :: Python :: 3.10
14
15
  Classifier: Programming Language :: Python :: 3.11
15
- Requires-Dist: beartype (>=0.16.1,<0.17.0)
16
- Requires-Dist: cola-ml (==0.0.5)
17
- Requires-Dist: flax (>=0.8.4,<0.9.0)
18
- Requires-Dist: jax (<0.4.28)
19
- Requires-Dist: jaxlib (<0.4.28)
20
- Requires-Dist: jaxopt (>=0.8.3,<0.9.0)
21
- Requires-Dist: jaxtyping (>=0.2.10,<0.3.0)
22
- Requires-Dist: numpy (<2.0.0)
23
- Requires-Dist: optax (>=0.2.1,<0.3.0)
24
- Requires-Dist: tensorflow-probability (>=0.24.0,<0.25.0)
25
- Requires-Dist: tqdm (>=4.66.2,<5.0.0)
26
- Project-URL: Documentation, https://docs.jaxgaussianprocesses.com/
27
- Project-URL: Repository, https://github.com/JaxGaussianProcesses/GPJax
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: Implementation :: CPython
18
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
19
+ Requires-Python: <3.13,>=3.10
20
+ Requires-Dist: beartype>0.16.1
21
+ Requires-Dist: cola-ml==0.0.5
22
+ Requires-Dist: flax>=0.8.5
23
+ Requires-Dist: jax<0.4.28
24
+ Requires-Dist: jaxlib<0.4.28
25
+ Requires-Dist: jaxopt==0.8.2
26
+ Requires-Dist: jaxtyping>0.2.10
27
+ Requires-Dist: numpy<2.0.0
28
+ Requires-Dist: optax>0.2.1
29
+ Requires-Dist: tensorflow-probability>=0.24.0
30
+ Requires-Dist: tqdm>4.66.2
28
31
  Description-Content-Type: text/markdown
29
32
 
30
33
  <!-- <h1 align='center'>GPJax</h1>
31
34
  <h2 align='center'>Gaussian processes in Jax.</h2> -->
32
35
  <p align="center">
33
- <img width="700" height="300" src="https://raw.githubusercontent.com/JaxGaussianProcesses/GPJax/main/docs/_static/gpjax_logo.svg" alt="GPJax's logo">
36
+ <img width="700" height="300" src="https://raw.githubusercontent.com/JaxGaussianProcesses/GPJax/main/docs/static/gpjax_logo.svg" alt="GPJax's logo">
34
37
  </p>
35
38
 
36
39
  [![codecov](https://codecov.io/gh/JaxGaussianProcesses/GPJax/branch/master/graph/badge.svg?token=DM1DRDASU2)](https://codecov.io/gh/JaxGaussianProcesses/GPJax)
@@ -234,13 +237,14 @@ configuration in development mode.
234
237
  ```bash
235
238
  git clone https://github.com/JaxGaussianProcesses/GPJax.git
236
239
  cd GPJax
237
- poetry install
240
+ hatch env create
241
+ hatch shell
238
242
  ```
239
243
 
240
244
  > We recommend you check your installation passes the supplied unit tests:
241
245
  >
242
246
  > ```python
243
- > poetry run pytest
247
+ > hatch run dev:test
244
248
  > ```
245
249
 
246
250
  # Citing GPJax
@@ -261,4 +265,3 @@ If you use GPJax in your research, please cite our [JOSS paper](https://joss.the
261
265
  journal = {Journal of Open Source Software}
262
266
  }
263
267
  ```
264
-
@@ -1,36 +1,43 @@
1
- LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
2
- gpjax/__init__.py,sha256=ZCiDPPFtUkWm4x1f8FXnkGcXmFf1d8JZBP-gy0_SLCU,1697
1
+ gpjax/__init__.py,sha256=Bx5JFaveeVk3qJMTzbmrKOFy0U7fNcQ_JnVo5m0ACGA,1697
3
2
  gpjax/citation.py,sha256=R4Pmvjt0ndA0avEDSvIbxDxKapkRRYXWX7RRWBvZCRQ,5306
4
3
  gpjax/dataset.py,sha256=NsToLKq4lOsHnfLfukrUIRKvhOEuoUk8aHTF0oAqRbU,4079
4
+ gpjax/distributions.py,sha256=zxkSEZIlTg0PHvvgj0BQuIFEg-ugx6_NkEwSsbqWUM0,9325
5
+ gpjax/fit.py,sha256=OHv8jUHxa1ndpqMERSDRtYtUDzubk9rMPVIhfCiIH5Q,11551
6
+ gpjax/gps.py,sha256=NO18geRfcjo4mA3PGkuGont_Mj_yRqfvWzJqYmoKwiY,31225
7
+ gpjax/integrators.py,sha256=eyJPqWNPKj6pKP5da0fEj4HW7BVyevqeGrurEuy_XPw,5694
8
+ gpjax/likelihoods.py,sha256=Uh4kgLTod8ODw178L--G3w4olpm9XvCdcAZ8l7FwkF4,9255
9
+ gpjax/lower_cholesky.py,sha256=3pnHaBrlGckFsrfYJ9Lsbd0pGmO7NIXdyY4aGm48MpY,1952
10
+ gpjax/mean_functions.py,sha256=et2HzlsYJNViBvTohF2wZYgCWQfDX4KboYeO7egMR1c,6420
11
+ gpjax/objectives.py,sha256=XwkPyL_iovTNKpKGVNt0Lt2_OMTJitSPhuyCtUrJpbc,15383
12
+ gpjax/parameters.py,sha256=Z4Wy3gEzPZG23-dtqC437_ZWnd_sPe9LcLCKn21ZBvA,4886
13
+ gpjax/scan.py,sha256=mtMsg8yLdkVuOYeTHLnATPGfGDnCMAQNdUA-FJlpfLs,5475
14
+ gpjax/typing.py,sha256=M3CvWsYtZ3PFUvBvvbRNjpwerNII0w4yGuP0I-sLeYI,1705
15
+ gpjax/variational_families.py,sha256=Eik5CCU7qH7_7cacpZ-1lIXm4tElELwSYfVw-n0rI20,27742
5
16
  gpjax/decision_making/__init__.py,sha256=SDuPQl80lJ7nhfRsiB_7c22wCMiQO5ehSNohxUGnB7w,2170
6
17
  gpjax/decision_making/decision_maker.py,sha256=S4pOXrWcEHy0NDA0gfWzhk7pG0NJfaPpMXvq03yTy0g,13915
7
18
  gpjax/decision_making/posterior_handler.py,sha256=UgXf1Gu7GMh2YDSmiSWJIzmWlFW06KTS44HYz3mazZQ,5905
8
19
  gpjax/decision_making/search_space.py,sha256=bXwtMOhHZ2klnABpXm5Raxe7b0NTRDjo_cN3ecbk53Y,3545
20
+ gpjax/decision_making/utility_maximizer.py,sha256=VT2amwSJbB64IL_MiWNl9ZgjcqO757qK6NW2gUBKsqs,5965
21
+ gpjax/decision_making/utils.py,sha256=5j1GO5kcmG2laZR39NjhqgEjRekAWWzrnREv_5Zct_Y,2367
9
22
  gpjax/decision_making/test_functions/__init__.py,sha256=GDCY9_kaAnxDWwzo1FkdxnDx-80MErAHchbGybT9xYs,1109
10
- gpjax/decision_making/test_functions/continuous_functions.py,sha256=BdqqPfr4E--LWM_xKTrwEEOLBfRKqjcvd251RR5brCU,5672
23
+ gpjax/decision_making/test_functions/continuous_functions.py,sha256=oL5ZQkvmbC3u9rEvSYI2DRAN3r7Ynf7wRZQlUWjKjt0,5612
11
24
  gpjax/decision_making/test_functions/non_conjugate_functions.py,sha256=cfo3xQOzB5ajMjjl0YFfNlJClkAcY7ZbT23UyBYEofQ,2955
12
25
  gpjax/decision_making/utility_functions/__init__.py,sha256=xXI-4JKWAfTJ7XZ1vRDpqtb91MNzSPD0lP6xo0tOc7o,1445
13
26
  gpjax/decision_making/utility_functions/base.py,sha256=FOqrsRDmtHiCVl6IHr12-AEYBLStzMT5EBs-F92e1Og,3882
14
27
  gpjax/decision_making/utility_functions/expected_improvement.py,sha256=H6hjC-lj1oiHf2BomeQqroORQ7vtcOngiDAWxRwkNbg,4481
15
28
  gpjax/decision_making/utility_functions/probability_of_improvement.py,sha256=O_rHH1yR34JJlpAueSDJ_yo95fPI2aAGkwphS8snBYk,5220
16
29
  gpjax/decision_making/utility_functions/thompson_sampling.py,sha256=S-Yyn-9jsKkaXTvKFBP4sG_eCCKApGbHao5RR5tqXAo,4353
17
- gpjax/decision_making/utility_maximizer.py,sha256=VT2amwSJbB64IL_MiWNl9ZgjcqO757qK6NW2gUBKsqs,5965
18
- gpjax/decision_making/utils.py,sha256=5j1GO5kcmG2laZR39NjhqgEjRekAWWzrnREv_5Zct_Y,2367
19
- gpjax/distributions.py,sha256=X48FJr3reop9maherdMVt7-XZOm2f26T8AJt_IKM_oE,9339
20
- gpjax/fit.py,sha256=OHv8jUHxa1ndpqMERSDRtYtUDzubk9rMPVIhfCiIH5Q,11551
21
- gpjax/gps.py,sha256=S5_TRG8ki40zpEsizbZ_S9kEppjGcoTEXzFZxVON0WI,30692
22
- gpjax/integrators.py,sha256=eyJPqWNPKj6pKP5da0fEj4HW7BVyevqeGrurEuy_XPw,5694
23
30
  gpjax/kernels/__init__.py,sha256=WZanH0Tpdkt0f7VfMqnalm_VZAMVwBqeOVaICNj6xQU,1901
24
- gpjax/kernels/approximations/__init__.py,sha256=bK9HlGd-PZeGrqtG5RpXxUTXNUrZTgfjH1dP626yNMA,68
25
- gpjax/kernels/approximations/rff.py,sha256=swo7aoqvmwXff2hIcw8HFxD7kJG0IgfVru5XXzxaeys,4127
26
31
  gpjax/kernels/base.py,sha256=abkj3zidsBs7YSkYEfjeJ5jTs1YyDCPoBM2ZzqaqrgI,11561
32
+ gpjax/kernels/approximations/__init__.py,sha256=bK9HlGd-PZeGrqtG5RpXxUTXNUrZTgfjH1dP626yNMA,68
33
+ gpjax/kernels/approximations/rff.py,sha256=4kD1uocjHmxkLgvf4DxB4_Gy7iefdPgnWiZB3jDiExI,4126
27
34
  gpjax/kernels/computations/__init__.py,sha256=uTVkqvnZVesFLDN92h0ZR0jfR69Eo2WyjOlmSYmCPJ8,1379
28
- gpjax/kernels/computations/base.py,sha256=6L96GwL_6jkjLdvLv3CSAnqK2wJ-vkeVxBfjq7rjqVc,3659
35
+ gpjax/kernels/computations/base.py,sha256=zzabLN_-FkTWo6cBYjzjvUGYa7vrYyHxyrhQZxLgHBk,3651
29
36
  gpjax/kernels/computations/basis_functions.py,sha256=zY4rUDZDLOYvQPY9xosRmCLPdiXfbzAN5GICjQhFOis,2528
30
37
  gpjax/kernels/computations/constant_diagonal.py,sha256=_4fIFPq76Z416-9dIr8N335WP291dGluO-RqqUsK9ZY,2058
31
38
  gpjax/kernels/computations/dense.py,sha256=vnW6XKQe4_gzpXRWTctxhgMA9-9TebdtiXzAqh_-j6g,1392
32
39
  gpjax/kernels/computations/diagonal.py,sha256=z2JpUue7oY-pL-c0Pc6Bngv_IJCR6z4MaW7kN0wgjxk,1803
33
- gpjax/kernels/computations/eigen.py,sha256=Kx4f59u1r7srlcBVh7z-kfll_K7Km53caAIZYU-5bQ0,1931
40
+ gpjax/kernels/computations/eigen.py,sha256=w7I7LK42j0ouchHCI1ltXx0lpwqvK1bRb4HclnF3rKs,1936
34
41
  gpjax/kernels/non_euclidean/__init__.py,sha256=RT7puRPqCTpyxZ16q596EuOQEQi1LK1v3J9_fWz1NlY,790
35
42
  gpjax/kernels/non_euclidean/graph.py,sha256=K4WIdX-dx1SsWuNHZnNjHFw8ElKZxGcReUiA3w4aCOI,4204
36
43
  gpjax/kernels/non_euclidean/utils.py,sha256=z42aw8ga0zuREzHawemR9okttgrAUPmq-aN5HMt4SuY,1578
@@ -40,7 +47,7 @@ gpjax/kernels/nonstationary/linear.py,sha256=UKDHFCQzKWDMYo76qcb5-ujjnP2_iL-1tcN
40
47
  gpjax/kernels/nonstationary/polynomial.py,sha256=yTGobMPbCnKlj4PiQPSXEkWNrj2sjg_x9zFsnFa_j4E,3257
41
48
  gpjax/kernels/stationary/__init__.py,sha256=j4BMTaQlIx2kNAT1Dkf4iO2rm-f7_oSVWNrk1bN0tqE,1406
42
49
  gpjax/kernels/stationary/base.py,sha256=pQNkMo-E4bIT4tNfb7JvFJZC6fIIXNErsT1iQopFlAA,7063
43
- gpjax/kernels/stationary/matern12.py,sha256=kFnCxow-xURxxGyUS15G9pUC91X8WPpyCJWQh-xNe8c,1806
50
+ gpjax/kernels/stationary/matern12.py,sha256=b2vQCUqhd9NJK84L2RYjpI597uxy_7xgwsjS35Gc958,1807
44
51
  gpjax/kernels/stationary/matern32.py,sha256=ZVYbUIQhvKpriC7abH8wV6Pk-mRoxtl3e2YYwH-KM5Y,2000
45
52
  gpjax/kernels/stationary/matern52.py,sha256=xfMYbY7MXxgMECtA2qVT5I8HoDGzGxygUvduGT3_Gvs,2053
46
53
  gpjax/kernels/stationary/periodic.py,sha256=IAbCxURtJEHGdmYzbdrsqRZ3zJ8F8tGQF9O7sggafZk,3598
@@ -49,16 +56,7 @@ gpjax/kernels/stationary/rational_quadratic.py,sha256=dYONp3i4rnKj3ET8UyxAKXv6UO
49
56
  gpjax/kernels/stationary/rbf.py,sha256=G13gg5phO7ite7D9QgoCy7gB2_y0FM6GZhgFW4RL6Xw,1734
50
57
  gpjax/kernels/stationary/utils.py,sha256=Xa9EEnxgFqEi08ZSFAZYYHhJ85_3Ac-ZUyUk18B63M4,2225
51
58
  gpjax/kernels/stationary/white.py,sha256=TkdXXZCCjDs7JwR_gj5uvn2s1wyfRbe1vyHhUMJ8jjI,2212
52
- gpjax/likelihoods.py,sha256=Uh4kgLTod8ODw178L--G3w4olpm9XvCdcAZ8l7FwkF4,9255
53
- gpjax/lower_cholesky.py,sha256=3pnHaBrlGckFsrfYJ9Lsbd0pGmO7NIXdyY4aGm48MpY,1952
54
- gpjax/mean_functions.py,sha256=et2HzlsYJNViBvTohF2wZYgCWQfDX4KboYeO7egMR1c,6420
55
- gpjax/objectives.py,sha256=XwkPyL_iovTNKpKGVNt0Lt2_OMTJitSPhuyCtUrJpbc,15383
56
- gpjax/parameters.py,sha256=Z4Wy3gEzPZG23-dtqC437_ZWnd_sPe9LcLCKn21ZBvA,4886
57
- gpjax/progress_bar.py,sha256=ErXoJ-jjEPOediq_clgG2OC0UTptpP0MtVM1a2ZLC_o,4418
58
- gpjax/scan.py,sha256=mtMsg8yLdkVuOYeTHLnATPGfGDnCMAQNdUA-FJlpfLs,5475
59
- gpjax/typing.py,sha256=M3CvWsYtZ3PFUvBvvbRNjpwerNII0w4yGuP0I-sLeYI,1705
60
- gpjax/variational_families.py,sha256=Eik5CCU7qH7_7cacpZ-1lIXm4tElELwSYfVw-n0rI20,27742
61
- gpjax-0.9.0.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
62
- gpjax-0.9.0.dist-info/METADATA,sha256=G7J-o4TCBUL91jmsNFHOzJ6f4pxMByGfExUnC6rcx1E,9844
63
- gpjax-0.9.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
64
- gpjax-0.9.0.dist-info/RECORD,,
59
+ gpjax-0.9.2.dist-info/METADATA,sha256=JWT3cDW7onuKnTYUGqa15WxG4L7oEboJKPHYyAggYZ0,9976
60
+ gpjax-0.9.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
61
+ gpjax-0.9.2.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
62
+ gpjax-0.9.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: hatchling 1.25.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
gpjax/progress_bar.py DELETED
@@ -1,131 +0,0 @@
1
- # Copyright 2023 The JaxGaussianProcesses Contributors. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- # ==============================================================================
15
-
16
- from beartype.typing import (
17
- Any,
18
- Callable,
19
- Union,
20
- )
21
- from jax import lax
22
- from jax.experimental import host_callback
23
- from jaxtyping import Float # noqa: TCH002
24
- from tqdm.auto import tqdm
25
-
26
- from gpjax.typing import Array # noqa: TCH001
27
-
28
-
29
- def progress_bar(num_iters: int, log_rate: int) -> Callable:
30
- r"""Progress bar decorator for the body function of a `jax.lax.scan`.
31
-
32
- Example:
33
- ```python
34
- >>> import jax.numpy as jnp
35
- >>> import jax
36
- >>>
37
- >>> carry = jnp.array(0.0)
38
- >>> iteration_numbers = jnp.arange(100)
39
- >>>
40
- >>> @progress_bar(num_iters=iteration_numbers.shape[0], log_rate=10)
41
- >>> def body_func(carry, x):
42
- >>> return carry, x
43
- >>>
44
- >>> carry, _ = jax.lax.scan(body_func, carry, iteration_numbers)
45
- ```
46
-
47
- Adapted from this [excellent blog post](https://www.jeremiecoullon.com/2021/01/29/jax_progress_bar/).
48
-
49
- Might be nice in future to directly create a general purpose `verbose scan`
50
- inplace of a for a jax.lax.scan, that takes the same arguments as a jax.lax.scan,
51
- but prints a progress bar.
52
- """
53
- tqdm_bars = {}
54
- remainder = num_iters % log_rate
55
-
56
- """Define a tqdm progress bar."""
57
- tqdm_bars[0] = tqdm(range(num_iters))
58
- tqdm_bars[0].set_description("Compiling...", refresh=True)
59
-
60
- def _update_tqdm(args: Any, transform: Any) -> None:
61
- r"""Update the tqdm progress bar with the latest objective value."""
62
- value, iter_num = args
63
- tqdm_bars[0].set_description("Running", refresh=False)
64
- tqdm_bars[0].update(iter_num)
65
- tqdm_bars[0].set_postfix({"Value": f"{value: .2f}"})
66
-
67
- def _close_tqdm(args: Any, transform: Any) -> None:
68
- r"""Close the tqdm progress bar."""
69
- tqdm_bars[0].close()
70
-
71
- def _callback(cond: bool, func: Callable, arg: Any) -> None:
72
- r"""Callback a function for a given argument if a condition is true."""
73
- dummy_result = 0
74
-
75
- def _do_callback(_) -> int:
76
- """Perform the callback."""
77
- return host_callback.id_tap(func, arg, result=dummy_result)
78
-
79
- def _not_callback(_) -> int:
80
- """Do nothing."""
81
- return dummy_result
82
-
83
- _ = lax.cond(cond, _do_callback, _not_callback, operand=None)
84
-
85
- def _update_progress_bar(value: Float[Array, "1"], iter_num: int) -> None:
86
- r"""Update the tqdm progress bar."""
87
- # Conditions for iteration number
88
- is_multiple: bool = (iter_num % log_rate == 0) & (
89
- iter_num != num_iters - remainder
90
- )
91
- is_remainder: bool = iter_num == num_iters - remainder
92
- is_last: bool = iter_num == num_iters - 1
93
-
94
- # Update progress bar, if multiple of log_rate
95
- _callback(is_multiple, _update_tqdm, (value, log_rate))
96
-
97
- # Update progress bar, if remainder
98
- _callback(is_remainder, _update_tqdm, (value, remainder))
99
-
100
- # Close progress bar, if last iteration
101
- _callback(is_last, _close_tqdm, None)
102
-
103
- def _progress_bar(body_fun: Callable) -> Callable:
104
- r"""Decorator that adds a progress bar to `body_fun` used in `jax.lax.scan`."""
105
-
106
- def wrapper_progress_bar(carry: Any, x: Union[tuple, int]) -> Any:
107
- # Get iteration number
108
- if type(x) is tuple:
109
- iter_num, *_ = x
110
- else:
111
- iter_num = x
112
-
113
- # Compute iteration step
114
- result = body_fun(carry, x)
115
-
116
- # Get value
117
- *_, value = result
118
-
119
- # Update progress bar
120
- _update_progress_bar(value, iter_num)
121
-
122
- return result
123
-
124
- return wrapper_progress_bar
125
-
126
- return _progress_bar
127
-
128
-
129
- __all__ = [
130
- "progress_bar",
131
- ]
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "{}"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright {yyyy} {name of copyright owner}
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
File without changes