ciderpress.models.kernels

class ciderpress.models.kernels.ADKernel(k, active_dims)
property bounds

Returns the log-transformed bounds on the theta. :returns: bounds – The log-transformed bounds on the kernel’s hyperparameters theta :rtype: ndarray of shape (n_dims, 2)

diag(X)

Returns the diagonal of the kernel k(X, X).

The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.

Parameters:

X (array-like of shape (n_samples,)) – Left argument of the returned kernel k(X, Y)

Returns:

K_diag – Diagonal of kernel k(X, X)

Return type:

ndarray of shape (n_samples_X,)

get_params(deep=True)

Get parameters of this kernel.

Parameters:

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params – Parameter names mapped to their values.

Return type:

dict

property hyperparameters

Returns a list of all hyperparameter.

is_stationary()

Returns whether the kernel is stationary.

property requires_vector_input

Returns whether the kernel is stationary.

property theta

Returns the (flattened, log-transformed) non-fixed hyperparameters. Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale. :returns: theta – The non-fixed, log-transformed hyperparameters of the kernel :rtype: ndarray of shape (n_dims,)

class ciderpress.models.kernels.DensityNoise(index=0)
diag(X)

Returns the diagonal of the kernel k(X, X).

The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.

Parameters:

X (array-like of shape (n_samples,)) – Left argument of the returned kernel k(X, Y)

Returns:

K_diag – Diagonal of kernel k(X, X)

Return type:

ndarray of shape (n_samples_X,)

class ciderpress.models.kernels.DiffARBF(order=1, length_scale=1.0, scale=None, length_scale_bounds=(1e-05, 100000.0), scale_bounds=(1e-05, 100000.0))

Additive RBF kernel of Duvenaud et al.

Parameters:
  • order (int) – Order of kernel

  • length_scale (float or array) – length scale of kernel

  • scale (array) – coefficients of each order, starting with 0 and ascending.

  • length_scale_bounds – bounds of length_scale

  • scale_bounds – bounds of scale

diag(X)

Returns the diagonal of the kernel k(X, X).

The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.

Parameters:

X (ndarray of shape (n_samples_X, n_features)) – Left argument of the returned kernel k(X, Y)

Returns:

K_diag – Diagonal of kernel k(X, X)

Return type:

ndarray of shape (n_samples_X,)

k_and_deriv(X, Y=None)

Compute the kernel and its derivative with respect to the input X.

Parameters:
  • X – Inputs with respect to which the kernel derivative is evaluated.

  • Y – Other input. If None, set to X. Note: If Y is None i.e. X, Y is still assumed stationary, i.e. the return value is 0.5 * d k(X,X,) / dX

Returns:

k, (X.shape[0], Y.shape[0]) dk (X.shape[0], Y.shape[0], X.shape[1])

class ciderpress.models.kernels.DiffARBFV2(order=1, length_scale=1.0, scale=None, length_scale_bounds=(1e-05, 100000.0), scale_bounds=(1e-05, 100000.0))

Additive RBF kernel of Duvenaud et al.

Parameters:
  • order (int) – Order of kernel

  • length_scale (float or array) – length scale of kernel

  • scale (array) – coefficients of each order, starting with 0 and ascending.

  • length_scale_bounds – bounds of length_scale

  • scale_bounds – bounds of scale

is_stationary()

Returns whether the kernel is stationary.

class ciderpress.models.kernels.DiffAddLLRBF(order=1, alpha=1.0, length_scale=1.0, scale=None, length_scale_bounds=(1e-05, 100000.0), scale_bounds=(1e-05, 100000.0))

Additive RBF kernel of Duvenaud et al.

Parameters:
  • order (int) – Order of kernel

  • alpha (float) – Rational quadratic order

  • length_scale (float or array) – length scale of kernel

  • scale (array) – coefficients of each order, starting with 0 and ascending.

  • length_scale_bounds – bounds of length_scale

  • scale_bounds – bounds of scale

is_stationary()

Returns whether the kernel is stationary.

class ciderpress.models.kernels.DiffAddRQ(order=1, alpha=1.0, length_scale=1.0, scale=None, length_scale_bounds=(1e-05, 100000.0), scale_bounds=(1e-05, 100000.0))

Additive rational quadratic kernel

Parameters:
  • order (int) – Order of kernel

  • alpha (float) – Rational quadratic order

  • length_scale (float or array) – length scale of kernel

  • scale (array) – coefficients of each order, starting with 0 and ascending.

  • length_scale_bounds – bounds of length_scale

  • scale_bounds – bounds of scale

is_stationary()

Returns whether the kernel is stationary.

class ciderpress.models.kernels.DiffAdditiveMixin(order=1, length_scale=1.0, scale=None, length_scale_bounds=(1e-05, 100000.0), scale_bounds=(1e-05, 100000.0))

Need to define is_stationary, _get_k0_dk0_train, and _get_k0_dk0_eval.

Parameters:
  • order (int) – Order of kernel

  • length_scale (float or array) – length scale of kernel

  • scale (array) – coefficients of each order, starting with 0 and ascending.

  • length_scale_bounds – bounds of length_scale

  • scale_bounds – bounds of scale

diag(X)

NOTE: Quite inefficient, but this is not used much for the functionals anyway.

class ciderpress.models.kernels.DiffAntisymRBF(length_scale=1.0, length_scale_bounds=(1e-05, 100000.0))

This is like a regular RBF kernel, except it obeys a sort of “antisymmetry” property where k(x0, x1, x2, ….; x0’, x1’, x2’ ….) = 0 if x0 == x1 or x0’ == x1’. This property applies only to the first two features. It could be useful for enforcing exact constraints.

k_and_deriv(X, Y=None)

Compute the kernel and its derivative with respect to the input X.

Parameters:
  • X – Inputs with respect to which the kernel derivative is evaluated.

  • Y – Other input. If None, set to X. Note: If Y is None i.e. X, Y is still assumed stationary, i.e. the return value is 0.5 * d k(X,X,) / dX

Returns:

k, (X.shape[0], Y.shape[0]) dk (X.shape[0], Y.shape[0], X.shape[1])

class ciderpress.models.kernels.DiffConstantKernel(constant_value=1.0, constant_value_bounds=(1e-05, 100000.0))
class ciderpress.models.kernels.DiffExponentiation(kernel, exponent)
class ciderpress.models.kernels.DiffLinearKernel
diag(X)

Returns the diagonal of the kernel k(X, X).

The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.

Parameters:

X (array-like of shape (n_samples,)) – Left argument of the returned kernel k(X, Y)

Returns:

K_diag – Diagonal of kernel k(X, X)

Return type:

ndarray of shape (n_samples_X,)

is_stationary()

Returns whether the kernel is stationary.

class ciderpress.models.kernels.DiffPolyKernel(gamma=1.0, gamma_bounds=(1e-05, 100000.0), order=4, factorial=True)
diag(X)

Returns the diagonal of the kernel k(X, X).

The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.

Parameters:

X (array-like of shape (n_samples,)) – Left argument of the returned kernel k(X, Y)

Returns:

K_diag – Diagonal of kernel k(X, X)

Return type:

ndarray of shape (n_samples_X,)

is_stationary()

Returns whether the kernel is stationary.

class ciderpress.models.kernels.DiffProduct(k1, k2)
class ciderpress.models.kernels.DiffRBF(length_scale=1.0, length_scale_bounds=(1e-05, 100000.0))
k_and_deriv(X, Y=None)

Compute the kernel and its derivative with respect to the input X.

Parameters:
  • X – Inputs with respect to which the kernel derivative is evaluated.

  • Y – Other input. If None, set to X. Note: If Y is None i.e. X, Y is still assumed stationary, i.e. the return value is 0.5 * d k(X,X,) / dX

Returns:

k, (X.shape[0], Y.shape[0]) dk (X.shape[0], Y.shape[0], X.shape[1])

class ciderpress.models.kernels.DiffSum(k1, k2)
class ciderpress.models.kernels.DiffTransform(kernel, matrix, std=None, avg=None)
property bounds

Returns the log-transformed bounds on the theta.

Returns:

bounds – The log-transformed bounds on the kernel’s hyperparameters theta

Return type:

ndarray of shape (n_dims, 2)

diag(X)

Returns the diagonal of the kernel k(X, X).

The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.

Parameters:

X (array-like of shape (n_samples,)) – Left argument of the returned kernel k(X, Y)

Returns:

K_diag – Diagonal of kernel k(X, X)

Return type:

ndarray of shape (n_samples_X,)

get_params(deep=True)

Get parameters of this kernel.

Parameters:

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params – Parameter names mapped to their values.

Return type:

dict

property hyperparameters

Returns a list of all hyperparameter.

is_stationary()

Returns whether the kernel is stationary.

property requires_vector_input

Returns whether the kernel is defined on discrete structures.

property theta

Returns the (flattened, log-transformed) non-fixed hyperparameters.

Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.

Returns:

theta – The non-fixed, log-transformed hyperparameters of the kernel

Return type:

ndarray of shape (n_dims,)

class ciderpress.models.kernels.DiffWhiteKernel(noise_level=1.0, noise_level_bounds=(1e-05, 100000.0))
class ciderpress.models.kernels.ExponentialDensityNoise(exponent=1.0, exponent_bounds=(0.1, 10))
diag(X)

Returns the diagonal of the kernel k(X, X).

The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.

Parameters:

X (array-like of shape (n_samples,)) – Left argument of the returned kernel k(X, Y)

Returns:

K_diag – Diagonal of kernel k(X, X)

Return type:

ndarray of shape (n_samples_X,)

class ciderpress.models.kernels.FittedDensityNoise(decay_rate=4.0, decay_rate_bounds=(1e-05, 100000.0))

Kernel to model the noise of the exchange enhancement factor based on the density. 1 / (1 + decay_rate * rho)

diag(X)

Returns the diagonal of the kernel k(X, X).

The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.

Parameters:

X (array-like of shape (n_samples,)) – Left argument of the returned kernel k(X, Y)

Returns:

K_diag – Diagonal of kernel k(X, X)

Return type:

ndarray of shape (n_samples_X,)

class ciderpress.models.kernels.PartialARBF(order=1, length_scale=1.0, length_scale_bounds=(1e-05, 100000.0), scale=1.0, scale_bounds=(1e-05, 100000.0), start=1, active_dims=None)

ARBF where subset of X is selected.

Parameters:
  • order (int) – Order of kernel

  • length_scale (float or array) – length scale of kernel

  • scale (array) – coefficients of each order, starting with 0 and ascending.

  • length_scale_bounds – bounds of length_scale

  • scale_bounds – bounds of scale

class ciderpress.models.kernels.PartialRBF(length_scale=1.0, length_scale_bounds=(1e-05, 100000.0), start=0, active_dims=None)

Child class of sklearn RBF which only acts on the slice X[:,start:] (or X[:,active_dims] if and only if active_dims is supplied). start is ignored if active_dims is supplied.

k_and_deriv(X, Y=None)

Compute the kernel and its derivative with respect to the input X.

Parameters:
  • X – Inputs with respect to which the kernel derivative is evaluated.

  • Y – Other input. If None, set to X. Note: If Y is None i.e. X, Y is still assumed stationary, i.e. the return value is 0.5 * d k(X,X,) / dX

Returns:

k, (X.shape[0], Y.shape[0]) dk (X.shape[0], Y.shape[0], X.shape[1])

class ciderpress.models.kernels.QARBF(ndim, length_scale, scale, scale_bounds=(1e-05, 100000.0))

ARBF, except order is restricted to 2 and the algorithm is more efficient.

diag(X)

Returns the diagonal of the kernel k(X, X).

The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.

Parameters:

X (array-like of shape (n_samples,)) – Left argument of the returned kernel k(X, Y)

Returns:

K_diag – Diagonal of kernel k(X, X)

Return type:

ndarray of shape (n_samples_X,)

class ciderpress.models.kernels.SingleDot(sigma_0=1.0, sigma_0_bounds=(1e-05, 100000.0), index=0)

DotProduct kernel with single index of X selected.

class ciderpress.models.kernels.SingleRBF(length_scale=1.0, length_scale_bounds=(1e-05, 100000.0), index=1)

RBF kernel with single index of X selected.

class ciderpress.models.kernels.SpinSymARBF(alpha_ind, beta_ind, *args, **kwargs)
Parameters:
  • alpha_ind – list/tuple of indexes or slice for alpha spin

  • beta_ind – list/tuple of indexes or slice for beta spin

  • *args and **kwargs – arguments to parent kernel

class ciderpress.models.kernels.SpinSymKernel(k, up_active_dims, down_active_dims)
get_params(deep=True)

Get parameters of this kernel.

Parameters:

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params – Parameter names mapped to their values.

Return type:

dict

class ciderpress.models.kernels.SpinSymPoly(alpha_ind, beta_ind, *args, **kwargs)
Parameters:
  • alpha_ind – list/tuple of indexes or slice for alpha spin

  • beta_ind – list/tuple of indexes or slice for beta spin

  • *args and **kwargs – arguments to parent kernel

class ciderpress.models.kernels.SpinSymRBF(alpha_ind, beta_ind, *args, **kwargs)
Parameters:
  • alpha_ind – list/tuple of indexes or slice for alpha spin

  • beta_ind – list/tuple of indexes or slice for beta spin

  • *args and **kwargs – arguments to parent kernel

class ciderpress.models.kernels.SubsetARBF(indexes, *args, **kwargs)

Initialize SubsetKernel :Parameters: * indexes – list/tuple of indexes or slice

  • *args and **kwargs – arguments to parent kernel

class ciderpress.models.kernels.SubsetAddLLRBF(indexes, *args, **kwargs)

Initialize SubsetKernel :Parameters: * indexes – list/tuple of indexes or slice

  • *args and **kwargs – arguments to parent kernel

class ciderpress.models.kernels.SubsetAddRQ(indexes, *args, **kwargs)

Initialize SubsetKernel :Parameters: * indexes – list/tuple of indexes or slice

  • *args and **kwargs – arguments to parent kernel

class ciderpress.models.kernels.SubsetPoly(indexes, *args, **kwargs)

Initialize SubsetKernel :Parameters: * indexes – list/tuple of indexes or slice

  • *args and **kwargs – arguments to parent kernel

class ciderpress.models.kernels.SubsetRBF(indexes, *args, **kwargs)

Initialize SubsetKernel :Parameters: * indexes – list/tuple of indexes or slice

  • *args and **kwargs – arguments to parent kernel