xnn.krnn.common.sgdml_iterative#

Iterative solve of the (s)GDML fit for training sets whose kernel matrix does not fit in memory.

The system (lam I - K) z = y (alpha = -z) is solved by preconditioned conjugate gradients without forming K: a product K v is the gradient of the kernel expansion with the coefficients v, evaluated at the training geometries and taken through their descriptor Jacobians (the energies for the energy rows), the same sums the model evaluates when it predicts. When memory allows, the kernel factors of every training pair are formed once and a product is three matrix products (PairFactors). The preconditioner is the inverse of a Nystrom approximation of lam I - K built from the rows of k inducing geometries, drawn with probabilities that follow their ridge leverage scores (estimated from a few random geometries).

Module Attributes

LEVERAGE_SAMPLE

geometries whose rows estimate the leverage scores that draw the inducing geometries

Functions

analytic_bytes(n)

Bytes of the analytic solve of an n-dimensional system (the matrix and its factor).

device_memory(device)

Total memory of device in GB (physical memory on a CPU).

inducing_count(n_train, n_atoms, max_memory)

The number of inducing geometries for a preconditioner within max_memory GB.

kernel_product(model, x, u, v[, ...])

K v for the kernel matrix of kernel_matrix(), without forming it.

solve_iterative(model, x, u, y, lam[, ...])

alpha with (K - lam I) alpha = y by preconditioned conjugate gradients.

Classes

PairFactors(model, x, u[, energy_constraint])

K v from the kernel factors of every training pair, formed once.