Commit 4a67895d authored by Lukas Platz's avatar Lukas Platz
Browse files

Start optimization at zero instead of rand position

Sample more often to make better use of the computation time.
Beforehand, when starting from zero, convergence was far from
reached in the time the demo ran, while much time was used
to optimize for the initial samples.
parent 1f84d24e
......@@ -70,13 +70,13 @@ if __name__ == '__main__':
# set up minimization and inversion schemes
ic_sampling = ift.GradientNormController(iteration_limit=100)
ic_newton = ift.GradInfNormController(
name='Newton', tol=1e-7, iteration_limit=1000)
name='Newton', tol=1e-7, iteration_limit=35)
minimizer = ift.NewtonCG(ic_newton)
# build model Hamiltonian
H = ift.Hamiltonian(likelihood, ic_sampling)
INITIAL_POSITION = ift.from_random('normal', H.domain)
INITIAL_POSITION = ift.MultiField.full(H.domain, 0.)
plot = ift.Plot()
......@@ -87,7 +87,7 @@ if __name__ == '__main__':
# number of samples used to estimate the KL
N_samples = 20
for i in range(2):
for i in range(5):
KL = ift.KL_Energy(position, H, N_samples)
KL, convergence = minimizer(KL)
position = KL.position
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment