by: Chris Cave & Jaan Kasak
(Feyn version 2.0 or newer)
Model is a mathematical function that can be optimised to a loss function in order to fit to a dataset. Fitting happens on the client side, and no communication occurs with the
QLattice in this step.
Here's an example of how to sample and fit models.
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=models, data=train, loss_function='binary_cross_entropy', criterion='bic', threads=4 )
This is the loss function that the
Models are optimised for. If no criterion is given, the returned list of
Models is sorted by this loss function in ascending order. It takes any loss function in the
feyn.losses module. Popular choices of loss functions are:
The criterion takes into account the complexity of the
Model when comparing losses. Higher complexity is penalized. Choices of criterion are:
- bic (Bayesion Information Criterion)
- aic (Akaike Information Criterion)
bic penalises complex models more than aic.
If a criterion is given, the returned list of
Models are sorted by that instead of the loss.
Determines how many concurrent threads to use during fitting. For best effect, set the threads parameter to match the number of threads available on your computer.