Priors
- gpax.priors.normal_dist(loc=None, scale=None)[source]
Generate a Normal distribution based on provided center (loc) and standard deviation (scale) parameters. If neither are provided, uses 0 and 1 by default. It can be used to pass custom priors to GP models.
- Return type:
Distribution
Examples
Assign custom prior to kernel lengthscale during GP model initialization
>>> model = gpax.ExactGP(input_dim, kernel, lengthscale_prior_dist=gpax.priors.normal_dist(5, 1))
Train as usual
>>> model.fit(rng_key, X, y)
- gpax.priors.lognormal_dist(loc=None, scale=None)[source]
Generate a LogNormal distribution based on provided center (loc) and standard deviation (scale) parameters. If neither are provided, uses 0 and 1 by default. It can be used to pass custom priors to GP models.
- Return type:
Distribution
Examples
Assign custom prior to kernel lengthscale during GP model initialization
>>> model = gpax.ExactGP(input_dim, kernel, lengthscale_prior_dist=gpax.priors.lognormal_dist(0, 0.1))
Train as usual
>>> model.fit(rng_key, X, y)
- gpax.priors.halfnormal_dist(scale=None)[source]
Generate a half-normal distribution based on provided standard deviation (scale). If none is provided, uses 1.0 by default. It can be used to pass custom priors to GP models.
- Return type:
Distribution
Examples
Assign custom prior to noise variance during GP model initialization
>>> model = gpax.ExactGP(input_dim, kernel, noise_prior_dist=gpax.priors.halfnormal_dist(0.1))
Train as usual
>>> model.fit(rng_key, X, y)
- gpax.priors.gamma_dist(c=None, r=None, input_vec=None)[source]
Generate a Gamma distribution based on provided shape (c) and rate (r) parameters. If the shape (c) is not provided, it attempts to infer it using the range of the input vector divided by 2. The rate parameter defaults to 1.0 if not provided. It can be used to pass custom priors to GP models.
- Return type:
Distribution
Examples
Assign custom prior to kernel lengthscale during GP model initialization
>>> model = gpax.ExactGP(input_dm, kernel, lengthscale_prior_dist=gpax.priors.gamma_dist(2, 5))
Train as usual
>>> model.fit(rng_key, X, y)
- gpax.priors.uniform_dist(low=None, high=None, input_vec=None)[source]
Generate a Uniform distribution based on provided low and high bounds. If one of the bounds is not provided, it attempts to infer the missing bound(s) using the minimum or maximum value from the input vector. It can be used to pass custom priors to GP models.
- Return type:
Distribution
Examples
Assign custom prior to kernel lengthscale during GP model initialization
>>> model = gpax.ExactGP(input_dm, kernel, lengthscale_prior_dist=gpax.priors.uniform_dist(1, 3))
Train as usual
>>> model.fit(rng_key, X, y)
- gpax.priors.auto_normal_priors(func, loc=0.0, scale=1.0)[source]
Places normal priors over function parameters.
- Parameters:
func (Callable) – The deterministic function for which to set normal priors.
loc (float, optional) – Mean of the normal distribution. Defaults to 0.0.
scale (float, optional) – Standard deviation of the normal distribution. Defaults to 1.0.
- Return type:
Callable- Returns:
A function that, when invoked, returns a dictionary of sampled values from normal distributions for each parameter of the original function.
- gpax.priors.auto_lognormal_priors(func, loc=0.0, scale=1.0)[source]
Places log-normal priors over function parameters.
- Parameters:
func (Callable) – The deterministic function for which to set log-normal priors.
loc (float, optional) – Mean of the log-normal distribution. Defaults to 0.0.
scale (float, optional) – Standard deviation of the log-normal distribution. Defaults to 1.0.
- Return type:
Callable- Returns:
A function that, when invoked, returns a dictionary of sampled values from log-normal distributions for each parameter of the original function.
- gpax.priors.auto_normal_kernel_priors(kernel_fn, loc=0.0, scale=1.0)[source]
Places normal priors over the kernel parameters.
- Parameters:
func (Callable) – The deterministic kernel function for which to set normal priors.
loc (float, optional) – Mean of the normal distribution. Defaults to 0.0.
scale (float, optional) – Standard deviation of the normal distribution. Defaults to 1.0.
- Return type:
Callable- Returns:
A function that, when invoked, returns a dictionary of sampled values from normal distributions for each parameter of the original kernel function.
- gpax.priors.auto_lognormal_kernel_priors(kernel_fn, loc=0.0, scale=1.0)[source]
Places log-normal priors over the kernel parameters.
- Parameters:
func (Callable) – The deterministic kernel function for which to set log-normal priors.
loc (float, optional) – Mean of the log-normal distribution. Defaults to 0.0.
scale (float, optional) – Standard deviation of the log-normal distribution. Defaults to 1.0.
- Return type:
Callable- Returns:
A function that, when invoked, returns a dictionary of sampled values from log-normal distributions for each parameter of the original kernel function.