objective
Objective Handling
MuyGPyS includes predefined objective functions and convenience functions for indicating them to optimization.
- MuyGPyS.optimize.objective.make_loo_crossval_fn(loss_fn, kernel_fn, mean_fn, var_fn, scale_fn, pairwise_diffs, crosswise_diffs, batch_nn_targets, batch_targets, batch_features=None, loss_kwargs={})[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.OptimizeFn
.- Parameters:
loss_fn (
LossFn
) – The loss functor used to evaluate model performance.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 a noise model.var_fn (
Callable
) – A function that realizes MuyGPs posterior variance prediction given a noise model.scale_fn (
Callable
) – A function that realizes variance scale parameter optimization given a noise model.pairwise_diffs (
ndarray
) – A tensor of shape(batch_count, nn_count, nn_count, feature_count)
containing the(nn_count, nn_count, feature_count)
-shaped pairwise nearest neighbor difference tensors corresponding to each of the batch elements.crosswise_diffs (
ndarray
) – A tensor of shape(batch_count, nn_count, feature_count)
whose last two dimensions list the difference between each feature of each batch element 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.batch_features (
Optional
[ndarray
]) – Matrix of floats of shape(batch_count, feature_count)
whose rows give the features for each batch element.loss_kwargs (
Dict
) – A dict listing any additional kwargs to pass to the loss function.
- Return type:
Callable
- Returns:
A Callable
objective_fn
.