himalaya.kernel_ridge.solve_kernel_ridge_eigenvalues

himalaya.kernel_ridge.solve_kernel_ridge_eigenvalues(K, Y, alpha=1.0, method='eigh', fit_intercept=False, negative_eigenvalues='zeros', n_targets_batch=None, random_state=None)[source]

Solve kernel ridge regression using eigenvalues decomposition.

Solve the kernel ridge regression:

w* = argmin_w ||K @ w - Y||^2 + alpha (w.T @ K @ w)
Parameters
Karray of shape (n_samples, n_samples)

Input kernel.

Yarray of shape (n_samples, n_targets)

Target data.

alphafloat, or array of shape (n_targets, )

Regularization parameter.

methodstr in {“eigh”, “svd”}

Method used to diagonalize the kernel.

fit_interceptboolean

Whether to fit an intercept. If False, K should be centered (see KernelCenterer), and Y must be zero-mean over samples.

negative_eigenvaluesstr in {“nan”, “error”, “zeros”}

If the decomposition leads to negative eigenvalues (wrongly emerging from float32 errors): - “error” raises an error. - “zeros” remplaces them with zeros. - “nan” returns nans if the regularization does not compensate twice the smallest negative value, else it ignores the problem.

n_targets_batchint or None

Size of the batch for over targets during cross-validation. Used for memory reasons. If None, uses all n_targets at once.

random_stateint, or None

Random generator seed. Not used.

Returns
dual_weightsarray of shape (n_samples, n_targets)

Kernel ridge coefficients.

interceptarray of shape (n_targets,)

Intercept. Only returned when fit_intercept is True.