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, target_mask=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 pairwise distances or feature-dimension-wise differences (extra feature_count dimension) between all pairs of nearest neighbors for each batch element.

  • crosswise_diffs (ndarray) – A tensor of shape (batch_count, nn_count) [+ (feature_count,)] containing the crosswise distances or feature-dimension-wise differences (extra feature_count dimension) between the batch elements and each of their nearest neighbors.

  • batch_nn_targets (ndarray) – Tensor of floats of shape (batch_count, nn_count) [+ (response_count,)] containing the expected (possibly multivariate) response for each nearest neighbor of each batch element.

  • batch_targets (ndarray) – Matrix of floats of shape (batch_count,) [+ (response_count,) listing the expected (possibly multivariate) responses for each batch element.

  • batch_features (Optional[ndarray]) – Optional matrix of floats of shape (batch_count, feature_count) whose rows give the features for each batch element.

  • target_mask (Optional[ndarray]) – An array of indices, listing the output dimensions of the prediction to be used for optimization.

  • loss_kwargs (Dict) – A dict listing any additional kwargs to pass to the loss function.

Return type:

Callable

Returns:

A Callable objective_fn.