Commit bb521cff authored by Philipp Arras's avatar Philipp Arras
Browse files

Renamings related to energy logging

parent 53fcd5ca
Pipeline #75502 passed with stages
in 9 minutes and 13 seconds
......@@ -116,7 +116,7 @@ if __name__ == '__main__':
iteration_limit=35)
ic_sampling.enable_logging()
ic_newton.enable_logging()
minimizer = ift.NewtonCG(ic_newton, activate_logging=True)
minimizer = ift.NewtonCG(ic_newton, enable_logging=True)
## number of samples used to estimate the KL
N_samples = 20
......
......@@ -167,7 +167,7 @@ class NewtonCG(DescentMinimizer):
def __init__(self, controller, napprox=0, line_searcher=None, name=None,
nreset=20, max_cg_iterations=200, energy_reduction_factor=0.1,
activate_logging=False):
enable_logging=False):
if line_searcher is None:
line_searcher = LineSearch(preferred_initial_step_size=1.)
super(NewtonCG, self).__init__(controller=controller,
......@@ -178,7 +178,7 @@ class NewtonCG(DescentMinimizer):
self._max_cg_iterations = max_cg_iterations
self._alpha = energy_reduction_factor
from .iteration_controllers import EnergyHistory
self._history = EnergyHistory() if activate_logging else None
self._history = EnergyHistory() if enable_logging else None
def get_descent_direction(self, energy, old_value=None):
if old_value is None:
......
......@@ -43,7 +43,7 @@ class IterationController(metaclass=NiftyMeta):
For analyzing minimization procedures IterationControllers can log energy
values together with the respective time stamps. In order to activate this
feature `activate_logging()` needs to be called.
feature `enable_logging()` needs to be called.
"""
CONVERGED, CONTINUE, ERROR = list(range(3))
......
......@@ -94,7 +94,7 @@ def test_kl(constants, point_estimates, mirror_samples, mf):
# Test constants (after some minimization)
cg = ift.GradientNormController(iteration_limit=5)
minimizer = ift.NewtonCG(cg, activate_logging=True)
minimizer = ift.NewtonCG(cg, enable_logging=True)
kl, _ = minimizer(kl)
if len(constants) != 2:
assert_(len(minimizer.inversion_history) > 0)
......
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