Diverse models
by: Kevin Broløs & Chris Cave
(Feyn version 3.0 or newer)
The number of potential models that can explain a dataset can vary. The function get_diverse_models
finds the best performing Model
s from a list that have evolved independently in the QLattice.
This allows you to filter down the list of possible models to choose from, and only look at the ones that are most likely to be structurally or behaviourally different.
Example
Continuing from the previous sections, we now add the get_diverse_models
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)
models = feyn.get_diverse_models(
models=models,
n=10
)
get_diverse_models
Parameters of models
The list of models to find the diverse models from. The function expects the list to be sorted by some metric, such as the loss.
n
The maximum amount of models to return from the list.