Updating a QLattice
by: Kevin Broløs & Chris Cave
(Feyn version 3.0 or newer)
A QLattice
can be considered as a probability distribution of Model
structures, that can be sampled from with the sample_model
function. A structure is defined as the input names, function names and their combinations inside a Model
. This excludes its weights and biases.
When you update the QLattice
with a list of Model
s, the probability density function is updated to encourage those structures. Without updating, the QLattice will keep generating models with a random structure.
Example
Continuing from the previous sections, we now add the update
function to our workflow.
import feyn
from feyn.datasets import make_classification
train, test = make_classification()
ql = feyn.QLattice()
models = ql.sample_models(train.columns, 'y', 'classification', max_complexity=10)
models = feyn.fit_models(models, train, 'binary_cross_entropy', 'bic', 4)
models = feyn.prune_models(models)
ql.update(
models=models
)
update
Parameters of models
The list of Model
s to update the QLattice
with.