Differentiable Covariance Kernels
These kernels extend scikit-learn covariance objects with derivatives with respect to descriptor coordinates. DFT kernels use those derivatives to construct XC potentials and occupation-derivative observations. Subset and spin-symmetry wrappers apply a base kernel to selected coordinates and preserve the corresponding derivative layout.
- 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.DiffAntisymRBF(length_scale=1.0, length_scale_bounds=(1e-05, 100000.0))
This is like a regular RBF kernel, except it obeys an antisymmetry-like constraint: \(k(x_0,x_1,x_2,\ldots;x'_0,x'_1,x'_2,\ldots)=0\) if \(x_0=x_1\) or \(x'_0=x'_1\). 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.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.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.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.SpinSymARBF(alpha_ind, beta_ind, *args, **kwargs)
Additive RBF kernel with alpha/beta spin symmetry.
Initialize a kernel with alpha/beta spin symmetry.
- Parameters:
alpha_ind – list/tuple of indexes or slice for alpha spin
beta_ind – list/tuple of indexes or slice for beta spin
*args – positional arguments to the parent kernel
**kwargs – keyword arguments to the parent kernel
- class ciderpress.models.kernels.SpinSymPoly(alpha_ind, beta_ind, *args, **kwargs)
Polynomial kernel with symmetry between alpha and beta spin features.
Initialize a kernel with alpha/beta spin symmetry.
- Parameters:
alpha_ind – list/tuple of indexes or slice for alpha spin
beta_ind – list/tuple of indexes or slice for beta spin
*args – positional arguments to the parent kernel
**kwargs – keyword arguments to the parent kernel
- class ciderpress.models.kernels.SpinSymRBF(alpha_ind, beta_ind, *args, **kwargs)
RBF kernel with symmetry between alpha and beta spin features.
Initialize a kernel with alpha/beta spin symmetry.
- Parameters:
alpha_ind – list/tuple of indexes or slice for alpha spin
beta_ind – list/tuple of indexes or slice for beta spin
*args – positional arguments to the parent kernel
**kwargs – keyword arguments to the parent kernel