Seeding a QLattice
by: Chris Cave
(Feyn version 3.0 or newer)
The QLattice
is a method of sampling Models
from a probability distribution so by it's nature the QLattice
is a stochastic method. Between instances of QLattices
, it is not guaranteed that they will give the same results.
The results are likely to be similar but not identical.
Reproducibility
In many instances, you will want to be able to reproduce your results, for example if you want to share it with a colleague or in a publication.
In this case, you can set the random seed for the QLattice
, and the results will be reproducible given the rest of the computational environment is also reproduced.
Example
Here's an example of how to seed the QLattice
:
import feyn
ql = feyn.QLattice(random_seed=42)
This will ensure that you will receive exactly the same Models
between identical training runs.