himalaya.kernel_ridge.solve_weighted_kernel_ridge_conjugate_gradient¶
- himalaya.kernel_ridge.solve_weighted_kernel_ridge_conjugate_gradient(Ks, Y, deltas, alpha=1.0, fit_intercept=False, initial_dual_weights=None, max_iter=100, tol=0.0001, n_targets_batch=None, random_state=None)[source]¶
Solve weighted kernel ridge regression using conjugate gradient.
Solve the kernel ridge regression:
w* = argmin_w ||K @ w - Y||^2 + alpha (w.T @ K @ w)
where the kernel K is a weighted sum of multiple kernels:
K = sum_i exp(deltas[i]) Ks[i]
- Parameters
- Ksarray of shape (n_kernels, n_samples, n_samples)
Input kernels.
- Ytorch.Tensor of shape (n_samples, n_targets)
Target data.
- deltasarray of shape (n_kernels, ) or (n_kernels, n_targets)
Kernel weights.
- alphafloat, or array of shape (n_targets, )
Regularization parameter.
- fit_interceptboolean
Whether to fit an intercept. If False, Ks should be centered (see KernelCenterer), and Y must be zero-mean over samples.
- initial_dual_weightsarray of shape (n_samples, n_targets)
Initial kernel ridge coefficients.
- max_iterint
Maximum number of conjugate gradient step.
- tolfloat > 0 or None
Tolerance for the stopping criterion.
- 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.