2.11. Restarting (continuing) an optimization¶
You can continue an optimization from where a previous one stopped. This works best with the CMAOptimizer.
2.11.1. Restarting with the CMAOptimizer¶
Make a copy of the directory
There are three different
100.conf.py, which will run an optimization for 100 iterations.
restart_100.conf.py, which specifies to restart from where the previous optimization left off for another 100 iterations.
200.conf.py, which runs an optimization for 200 iterations uninterrupted (for comparison purposes).
.conf.py files are not read from the GUI - instead you will need to recreate them if you use the ParAMS GUI.
18.104.22.168. Run the first 100 evaluations¶
Unlike the Getting Started: Lennard-Jones Potential for Argon tutorial, we here set
100, and use a CMA-ES optimizer. CMA-ES is a derivative-free
optimizer, and has many options. The three most important options are
sigma, describing how wide a distribution to initially sample,
popsize, giving the population size (how many evaluations are performed at each CMA iteration)
minsigma, giving a converge criterion for sigma. During the optimization, sigma will decrease, and if it reaches this value the optimization will stop.
Some more details about the CMA optimizer are given in the Run the ReaxFF parametrization section of the ReaxFF tutorial.
seed option gives a seed for the random number generator. You should
normally not set it, it is set here only so that your numbers will match the
ones in the tutorial.
In the output, you will see that the loss value fluctuates quite wildly in the beginning.
The CMAOptimizer works in parallel. In the output you may see the results seemingly printed “out of order”, for example the results for evaluation 61 might be printed before evaluation 60. That is completely normal for the CMAOptimizer in params.
22.214.171.124. Continue for another 100 iterations with a restart file¶
This optimization continues from where the previous one left off. This has the following consequences for the logged loss values:
- The logged loss values are smaller than in the previous optimization
- The logged loss values fluctuate less wildly than in the previous optimization
126.96.36.199. Compare to an uninterrupted run of 200 iterations¶
The logged loss functions are almost, but not perfectly identical. This is because the of the way loss function values are logged with the parallel CMA optimizer. See the figure at the top.
2.11.2. Restart with other optimizers (e.g. Nelder-Mead from Scipy)¶
For other optimizers, like the Nelder-Mead optimizer that was used in the first tutorial, there is no particular restart functionality in ParAMS. If you use these optimizers, simply continue from the optimized parameters.
GUI: The parameters are automatically updated to be the best parameters as the parametrization is running
Command-line: Specify in
parameter_interface = 'path/to/previous/optimization/training_set_results/latest/parameter_interface.yaml'