# Sample models

by: Kevin Broløs & Chris Cave

(Feyn version 3.0 or newer)

The `QLattice`

is a statistical source of models. We can sample models from the `QLattice`

by using the `QLattice.sample_models()`

function. Here we go through a small example using it.

## Example

```
import feyn
from feyn.datasets import make_classification
train, test = make_classification()
ql = feyn.QLattice()
models = ql.sample_models(
input_names=train.columns,
output_name='y',
kind='classification',
max_complexity=10
)
```

This returns a list of `Model`

s from the inputs to the output that have been sampled from the `QLattice`

.
There are many of them and they are not in any specific order.

`sample_models`

Parameters of ### input_names

The parameter `input_names`

can take an iterable of strings. For example:

- A list of strings.
`pd.DataFrame.columns`

`Dict.keys`

This is used to define the possible inputs of a `Model`

.

You can as a convenience pass in a `Dict`

or `pd.DataFrame`

, as it will iterate over the column names.

### output_name

This is the name of the output as a string.

### kind

The **kind** parameter can take one of **classification** or **regression** to specify the sampled `Model`

s. The default is a regression.

The difference between the two is that the final mathematical transform of a classification is a **logisitic** function:

$\frac{1}{1 + e^{-x}}$

which takes any value and maps it to a value between 0 and 1.

### max_complexity

The **max_complexity** parameter controls the complexity of the model. Low values of 4 or 5 will yield very simple models while values above 10 yield highly complex models. This is the number of edges in the graph representation of the `Model`

.