objective¶
Objective Handling
MuyGPyS includes predefined objective functions and convenience functions for indicating them to optimization.
- MuyGPyS.optimize.objective.make_loo_crossval_fn(opt_method, loss_method, loss_fn, kernel_fn, mean_fn, var_fn, sigma_sq_fn, pairwise_dists, crosswise_dists, batch_nn_targets, batch_targets)[source]¶
Prepare a leave-one-out cross validation function as a function purely of the hyperparameters to be optimized.
This function is designed for use with
MuyGPyS.optimize.chassis.optimize_from_tensors()
, and the format depends on theopt_method
argument.- Parameters
opt_method (
str
) – The name of the optimization method to be utilized.loss_method (
str
) – Indicates the loss function to be used.kernel_fn (
Callable
) – A function that realizes kernel tensors given a list of the free parameters.mean_fn (
Callable
) – A function that realizes MuyGPs posterior mean prediction given an epsilon value. The given value is unused if epsilon is fixed.var_fn (
Callable
) – A function that realizes MuyGPs posterior variance prediction given an epsilon value. The given value is unused if epsilon is fixed.sigma_sq_fn (
Callable
) – A function that realizessigma_sq
optimization given an epsilon value. The given value is unused if epsilon is fixed.pairwise_dists (
ndarray
) – Distance tensor of floats of shape(batch_count, nn_count, nn_count)
whose second two dimensions give the pairwise distances between the nearest neighbors of each batch element.crosswise_dists (
ndarray
) – Distance matrix of floats of shape(batch_count, nn_count)
whose rows give the distances between each batch element and its nearest neighbors.batch_nn_targets (
ndarray
) – Tensor of floats of shape(batch_count, nn_count, response_count)
containing the expected response for each nearest neighbor of each batch element.batch_targets (
ndarray
) – Matrix of floats of shape(batch_count, response_count)
whose rows give the expected response for each batch element.
- Return type
Callable
- Returns
A Callable
objective_fn
, whose format depends onopt_method
.
- MuyGPyS.optimize.objective.make_obj_fn(obj_method, opt_method, loss_method, *args)[source]¶
Prepare an objective function as a function purely of the hyperparameters to be optimized.
This function is designed for use with
MuyGPyS.optimize.chassis.optimize_from_tensors()
, and the format depends on theopt_method
argument.- Parameters
obj_method (
str
) – The name of the objective function to be minimized.opt_method (
str
) – The name of the optimization method to be utilized.loss_method (
str
) – Indicates the loss function to be used.
- Return type
Callable
- Returns
A Callable
objective_fn
, whose format depends onopt_method
.