whitening
#
unscent_warp#
- pyvbmc.whitening.unscent_warp(fun, x, sigma)[source]#
Compute the unscented transform of the warping function fun.
- Parameters:
- funfunction
A single-argument function which warps input points.
- x(n,D) or (D,) np.ndarray
The input mean for which to compute the unscented transform.
- sigma(n,D) or (D,) np.ndarray
The input matrix of standard deviations or scale parameters for which to compute the unscented transform.
- Returns:
- x_warped_mean(n,D) or (D,) np.ndarray
The unscented estimate of the mean.
- x_warped_sigma(n,D) np.ndarray
The unscented estimate of the standard deviation / scale parameters.
- x_warped(U,n,D) np.ndarray
The warped mean points at x_warped[0, :, :], and the warped std. simplex points, at [1:, :, :]. Here U=2*D+1.
- Raises:
- ValueError
If the rows/columns of x and sigma cannot be coerced to match.
warp_input#
- pyvbmc.whitening.warp_input(vp, optim_state, function_logger, options)[source]#
Compute input warping of variables and update the cached points in function_logger accordingly.
Currently supports only a whitening transformation: a rotation and rescaling of the inference space such that the variational posterior acheives unit diagonal covariance.
- Parameters:
- vpVariationalPosterior
The current VP object for which to compute the warping.
- optim_statedict
The dictionary recording the current optimization state.
- function_loggerFunctionLogger
The record including cached function values.
- Returns:
- parameter_transformerParameterTransformer
A ParameterTransformer object representing the new transformation between original coordinates and inference space coordinates, with the input warping applied.
- optim_statedict
An updated copy of the original optimization state dict.
- function_loggerFunctionLogger
An updated copy of the original function logger.
- warp_actionstr
The type of warping performed (“rotoscaling” or “warp”)
- Raises:
- NotImplementedError
If vbmc.options[“warp_nonlinear”] is set other than False.
warp_gp_and_vp#
- pyvbmc.whitening.warp_gp_and_vp(parameter_transformer, gp_old, vp_old, vbmc)[source]#
Update the GP and VP with a given warp transformation.
Applies an updated ParameterTransformer object (with new warping transformation) to the GP and VP parameters.
- Parameters:
- parameter_transformerParameterTransformer
The new (warped) transformation between input coordinates and inference coordinates.
- gp_oldgpr.GP
The current Gaussian process.
- vp_oldVariationalPosterior
The current variational posterior.
- vbmcVBMC
The current VBMC object.
- Returns:
- vpVariationalPosterior
An updated copy of the original variational posterior.
- hyp_warpeddict
An updated copy of the dictionary of original GP hyperparameters, with the warping transformation applied.