aepsych.utils

aepsych.utils module

aepsych.utils.make_scaled_sobol(lb, ub, size, seed=None)[source]
Parameters:
  • lb (Tensor) –

  • ub (Tensor) –

  • size (int) –

  • seed (Optional[int]) –

Return type:

Tensor

aepsych.utils.promote_0d(x)[source]
Parameters:

x (Union[Tensor, ndarray]) –

aepsych.utils.dim_grid(lower, upper, gridsize=30, slice_dims=None)[source]

Create a grid Create a grid based on lower, upper, and dim. :param - lower (‘int’) - lower bound: :param - upper (‘int’) - upper bound: :param - dim (‘int) - dimension: :param - gridsize (‘int’) - size for grid: :param - slice_dims (Optional: :type - slice_dims (Optional: value} dict :param dict) - values to use for slicing axes: :type dict) - values to use for slicing axes: value} dict :param as an {index: :type as an {index: value} dict

Returns:

grid – Tensor

Return type:

torch.FloatTensor

Parameters:
  • lower (Tensor) –

  • upper (Tensor) –

  • gridsize (int) –

  • slice_dims (Optional[Mapping[int, float]]) –

aepsych.utils.interpolate_monotonic(x, y, z, min_x=- inf, max_x=inf)[source]
aepsych.utils.get_lse_interval(model, mono_grid, target_level, cred_level=None, mono_dim=- 1, n_samps=500, lb=- inf, ub=inf, gridsize=30, **kwargs)[source]
Parameters:
  • model (botorch.models.gpytorch.GPyTorchModel) –

  • mono_grid (Union[Tensor, ndarray]) –

  • target_level (float) –

  • cred_level (Optional[float]) –

  • mono_dim (int) –

  • n_samps (int) –

  • lb (float) –

  • ub (float) –

  • gridsize (int) –

Return type:

Union[Tuple[Tensor, Tensor, Tensor], Tensor]

aepsych.utils.get_lse_contour(post_mean, mono_grid, level, mono_dim=- 1, lb=- inf, ub=inf)[source]
aepsych.utils.get_jnd_1d(post_mean, mono_grid, df=1, mono_dim=- 1, lb=- inf, ub=inf)[source]
aepsych.utils.get_jnd_multid(post_mean, mono_grid, df=1, mono_dim=- 1, lb=- inf, ub=inf)[source]
Parameters:
  • post_mean (Tensor) –

  • mono_grid (Tensor) –

  • df (int) –

  • mono_dim (int) –

  • lb (Union[Tensor, float]) –

  • ub (Union[Tensor, float]) –

Return type:

Tensor

aepsych.utils.get_bounds(config)[source]

Return the bounds for all parameters in config.

Parameters:

config (Config) – The config to find the bounds from.

Returns:

A [2, d] tensor with the lower and upper bounds for each

parameter.

Return type:

torch.Tensor

aepsych.utils.get_optimizer_options(config, name)[source]

Return the optimizer options for the model to pass to the SciPy L-BFGS-B optimizer. Only the somewhat useful ones for AEPsych are searched for: maxcor, ftol, gtol, maxfun, maxiter, maxls. See docs for details: https://docs.scipy.org/doc/scipy/reference/optimize.minimize-lbfgsb.html#optimize-minimize-lbfgsb

Parameters:
  • config (Config) – Config to search for options.

  • name (str) – Model name to look for options for.

Returns:

Dictionary of options to pass to SciPy’s minimize, assuming the

method is L-BFGS-B.

Return type:

Dict[str, Any]