# Updating a QLattice

by: Kevin Broløs & Chris Cave

(Feyn version 2.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.

```
import feyn
from feyn.datasets import make_classification
train, test = make_classification()
ql = feyn.connect_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, True, True)
models = feyn.best_diverse_models(models, 10, None)
ql.update(
models=models
)
```

## models

The list of `Model`

s to update the `QLattice`

with.