by: Kevin Broløs & Chris Cave
(Feyn version 2.1 or newer)
Models can be saved to a file for use at a later time or place.
Note: Due to incompatibilities in the different versions of the
QLatticein version 2.1, you are unable to load any models saved prior to version 2.1. If you need access to older models, we recommend you use a previous version of
Here is an example how:
import feyn from feyn.datasets import make_classification # Generate a dataset and put it into a dataframe train, test = make_classification() # Connect to a QLattice and run a classification simulation ql = feyn.connect_qlattice() models = ql.auto_run( data=train, output_name='y', kind='classification' ) # Save a model to a file models.save('my_model.json')
You can load the
Model using feyn.Model.load.
from feyn import Model model = Model.load('my_model.json') prediction = model.predict(test)
Model is saved and selected, you can load them into any
Python environment to do predictions. You don't need access to a
QLattice for this.
Model is no different from a
Model sampled from the
QLattice. For example, you can resume fitting a
Model after loading it.