netket.errors.InsufficientSamplesForSRWarning#
- exception netket.errors.InsufficientSamplesForSRWarning[source]#
Warning issued when using Stochastic Reconfiguration (SR) with insufficient samples.
This warning is raised when the number of samples is less than or equal to the number of parameters in a Stochastic Reconfiguration calculation. In this regime, the standard QGT-based formulation of SR becomes inefficient and potentially unstable.
Why this matters#
The standard SR/Natural Gradient Descent computes updates as:
\[\delta \theta = \tau (X^TX + \lambda \mathbb{I}_{N_P})^{-1} X^T E^{loc}\]where \(X \in \mathbb{R}^{N_s \times N_p}\) is the Jacobian of the log-wavefunction, with \(N_p\) the number of parameters and \(N_s\) the number of samples.
When \(N_s \leq N_p\), the matrix \(X^TX\) has rank at most \(N_s\), making it severely under-determined and requiring large regularization. This leads to poor convergence and potentially unstable optimization.
Recommended solution#
Switch to the kernel/minSR formulation which uses the Neural Tangent Kernel (NTK):
\[\delta \theta = \tau X^T(XX^T + \lambda \mathbb{I}_{N_s})^{-1} E^{loc}\]This formulation inverts a \(N_s \times N_s\) matrix instead of \(N_p \times N_p\), which is much more efficient and stable when \(N_s < N_p\).
Use :class:`netket.driver.VMC_SR` instead of :class:`netket.driver.VMC` with SR.
The VMC_SR driver automatically chooses the optimal formulation and provides the same mathematical result but with better performance and stability.
References
The kernel trick for SR was introduced by Chen & Heyl and Rende et al..
For a comprehensive discussion see the
netket.driver.VMC_SRdocumentation.