by: Kevin Broløs & Chris Cave
(Feyn version 2.0 or newer)
The number of potential models that can explain a dataset can vary. The function
best_diverse_models finds the best performing
Models from a list that are sufficiently diverse with respect to a distance function.
A common use for this list is to update your
QLattice with these models using
ql.update. This helps it find all the potential
Models for the data.
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=models, n=10, distance_func=None )
The list of models to find the best and sufficiently diverse from. The function expects the list to be sorted by some metric.
The amount of models to return from the list.
This is a callable function that takes two models and returns a boolean. If the value is
True then the model in first argument is sufficiently distant from the model in the second argument.
None is passed then the default
QLattice distance is used.