Updating priors
by: Kevin Broløs and Meera Machado
(Feyn version 3.0 or newer)
We can change the behaviour of how we sample Model
s from a QLattice
by supplying prior probabilities for each input.
This can be used to inform a QLattice
of our prior beliefs of the input variables. Inputs with higher prior values are more likely to appear in the sampled Model
s.
In short, a prior probability of an input x
in the context of a QLattice
denotes our prior belief of the importance of x
in predicting the output.
If no priors are given, all inputs are equally likely to appear when sampling a Model
.
Example
Here's an example of how to update the priors:
import feyn
priors = {"x1": 1., "x2": 0.99, "x3": 0.98, "x4": 0.97}
ql = feyn.QLattice()
ql.update_priors(priors, reset=True)
Calculating the priors
Refer to Estimating priors to see how the priors can be calculated based on the mutual information between each input variable and the output.
update_priors
Parameters of priors
A Dict
object where the keys
are the names of the input variables and the values
are the relative weights associated to each input.
reset
Default: True
A boolean that determines whether the existing priors should be reset (True) or merged with the new priors (False) when updating the QLattice
.