Settings¶
mgsl.Schedule
dataclass
¶
The localisation grid of a run. Every field is required.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_paths
|
int
|
Number of independent paths, i.e. of posterior samples. |
required |
tau_start
|
float
|
Localisation time at which the paths start (> 0). |
required |
tau_final
|
float
|
Localisation time the paths reach; the terminal fit that produces the samples is made there. |
required |
n_tau
|
int
|
Number of grid points (geometric from |
required |
taus
property
¶
The grid, float64 array of shape (n_tau,).
mgsl.MGVIOptions
dataclass
¶
Settings of the local MGVI fits made at every step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_samples_mgvi
|
int
|
Number of residual draws per fit. Each is mirrored, so the fit averages over
|
required |
n_iter_mgvi
|
int
|
Number of rounds (draw residuals, then Newton) per fit. Required. |
required |
newton
|
NewtonOptions
|
Newton-CG settings. Required (its |
required |
draw_cg
|
CGOptions
|
Stopping rules of the CG solves that draw residuals. |
CGOptions()
|
preconditioner
|
callable
|
|
None
|
mgsl.NewtonOptions
dataclass
¶
Stopping rules of the Newton-CG minimisation in each local fit.
The minimisation stops after maxiter steps, once the step taken has 1-norm
<= xtol * d (d the latent dimension), or once the objective decreased by less than
absdelta. Names, defaults and these stopping rules are those of NIFTy.re's Newton-CG.
Differences: the inner CG starts from whichever of zero and the step that ignores the
likelihood (y / (1 + tau) - x) has the smaller residual (NIFTy.re starts from zero),
and stops on its residual only (NIFTy.re also
stops it on the decrease of the CG objective), so it may take more iterations per
solve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
maxiter
|
int
|
Maximum number of Newton steps per round. Required. |
required |
xtol
|
float
|
Step-size tolerance, multiplied by the dimension |
1e-5
|
absdelta
|
float
|
Stop when the objective decreased by less than this. Off by default. |
None
|
cg
|
CGOptions
|
Iteration limits of the inner CG solves (and their tolerances if |
CGOptions()
|
adaptive_cg
|
bool
|
If True, the inner CG stops at a residual 1-norm of |
True
|
line_search
|
('armijo', 'nifty')
|
|
"armijo"
|
mgsl.CGOptions
dataclass
¶
Stopping rules of a conjugate-gradient solve.
The solve stops once the residual 2-norm is below max(tol * |b|, atol), after at least
miniter and at most maxiter iterations. Names and defaults are those of NIFTy.re's
conjugate gradients. CG tracks its residual by a recurrence that drifts from the true
residual b - A x in floating point; the true residual is recomputed every refresh
iterations and whenever the solve looks converged (one extra application of A each), so
convergence is always judged on the true residual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tol
|
float
|
Tolerance relative to the norm of the right-hand side |
1e-5
|
atol
|
float
|
Absolute tolerance on the residual norm. |
0
|
miniter
|
int
|
Minimum number of iterations. Default |
None
|
maxiter
|
int
|
Maximum number of iterations. Default |
None
|
refresh
|
int
|
Iterations between recomputations of the true residual (NIFTy.re uses 20). Without
them, badly conditioned solves drift and can end far from the solution; but each refresh
also perturbs the CG recurrence, so refreshing very often (every few iterations) slows
convergence. Each refresh costs one extra application of |
20
|
resolve(size)
¶
(miniter, maxiter) for a system of the given size, with NIFTy.re's fallbacks.
mgsl.grid(tau_from, tau_to, n)
¶
Geometric grid of n points from tau_from to tau_to.
The endpoints are exactly tau_from and tau_to (as float64), so a continuation built
with grid(state.tau, ...) starts exactly where the state is.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tau_from
|
float
|
First and last point, |
required |
tau_to
|
float
|
First and last point, |
required |
n
|
int
|
Number of points, at least 2. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Float64 array of shape |