Kernel Tools

Factory functions construct the RBF, antisymmetric, and additive kernels used by the model-building interfaces. Their length scales refer to transformed descriptor coordinates.

ciderpress.models.kernel_plans.kernel_tools.get_agpr_kernel(sinds, ainds, length_scale, scale=None, order=2, nsingle=1, opt_hparams=False, min_lscale=None)

Construct an additive-RBF (ARBF) covariance kernel.

The additive Gaussian process kernel expands the covariance in terms of feature subsets up to size order, optionally multiplied by a plain RBF factor over the sinds features.

Parameters:
  • sinds (array-like) – Feature indexes for the single (multiplicative) RBF factor; ignored if nsingle is 0.

  • ainds (array-like) – Feature indexes entering the additive kernel.

  • length_scale (np.ndarray) – Per-feature RBF length scales.

  • scale (list or None) – Covariance prefactors, one per additive order (default all 1). Should be of length order + 1.

  • order (int) – Maximum interaction order of the additive kernel.

  • nsingle (int) – Enable the multiplicative RBF factor when nonzero; 0 omits the factor. The selected features are given by sinds.

  • opt_hparams (bool) – If True, leave length scales and prefactors open for hyperparameter optimization; otherwise fix them.

  • min_lscale (float or None) – Lower length-scale optimization bound (default 0.01).

Returns:

A SubsetARBF kernel, or SubsetRBF * SubsetARBF when a single factor is requested.

ciderpress.models.kernel_plans.kernel_tools.get_antisym_rbf_kernel(length_scale, scale=1.0, opt_hparams=False, min_lscale=None)

Construct a constant-scaled antisymmetric RBF covariance kernel.

The returned kernel is antisymmetric to exchange of the first two feature inputs. So \(k(x_0, x_1, ...; x_0', x_1', ...) = -k(x_1, x_0, ...; x_0', x_1', ...)\) and \(k(x_0, x_1, ...; x_0', x_1', ...) = -k(x_0, x_1, ...; x_1', x_0', ...)\). This kernel can help with exact constraint enforcement because \(k(x_0, x_0, ...; x_0', x_1', ...) = 0\).

Parameters:
  • length_scale (np.ndarray) – Per-feature RBF length scales.

  • scale (float) – Initial constant covariance prefactor.

  • opt_hparams (bool) – If True, leave the length scales and prefactor open for hyperparameter optimization; otherwise fix them.

  • min_lscale (float or None) – Lower length-scale optimization bound (default 0.01).

Returns:

A product kernel DiffConstantKernel * DiffAntisymRBF for Gaussian process training.

ciderpress.models.kernel_plans.kernel_tools.get_rbf_kernel(indexes, length_scale, scale=1.0, opt_hparams=False, min_lscale=None)

Construct a constant-scaled RBF covariance kernel over a feature subset.

Parameters:
  • indexes (array-like) – Indexes of the features the kernel acts on.

  • length_scale (np.ndarray) – Per-feature RBF length scales; the entries selected by indexes are used.

  • scale (float) – Constant covariance prefactor.

  • opt_hparams (bool) – If True, leave the length scales and prefactor open for hyperparameter optimization; otherwise fix them.

  • min_lscale (float or None) – Lower length-scale optimization bound (default 0.01).

Returns:

A product kernel DiffConstantKernel * SubsetRBF for Gaussian process training.