xnn.krnn.common.sgdml_iterative.solve_iterative#
- xnn.krnn.common.sgdml_iterative.solve_iterative(model, x, u, y, lam, energy_constraint=False, tol=0.0001, n_inducing=None, max_memory=None, max_iter=None, generator=None)[source]#
alphawith(K - lam I) alpha = yby preconditioned conjugate gradients.- Parameters:
model (SGDML) – Supplies the kernel and the permutations (closed under inversion, so that the system is symmetric).
x (Tensor) –
(M, D)training descriptors and(M, D, 3)their pair gradients.u (Tensor) –
(M, D)training descriptors and(M, D, 3)their pair gradients.y (Tensor) – Right-hand side (scaled labels).
lam (float) – Regularization.
energy_constraint (bool, optional) – Whether the system has energy rows.
tol (float, optional) – Relative residual
|r| / |y|at which the iterations stop, by default 1e-4.n_inducing (int, optional) – Inducing geometries of the preconditioner; by default as many as
max_memoryholds.max_memory (float, optional) – Memory in GB for the preconditioner and, when half of it holds them, the kernel factors of every training pair (
PairFactors); by default the device’s.max_iter (int, optional) – Iteration limit, by default ten times the size of the system.
generator (torch.Generator, optional) – Random numbers of the inducing geometries.
- Returns:
alphaand the solver’s record (iterations,residual,converged,n_inducing).- Return type:
tuple of Tensor and dict