Feyn Documentation

Feyn Documentation

  • Learn
  • Guides
  • Tutorials
  • API Reference
  • FAQ

›Essentials

Getting Started

  • Quick start
  • Using Feyn
  • Installation
  • What is the QLattice?

Essentials

  • Auto Run
  • Summary plot
  • Plot response
  • Splitting a dataset
  • Seeding a QLattice
  • Predicting with a model
  • Saving and loading models
  • Categorical features

Evaluate Regressors

  • Regression plot
  • Residuals plot

Evaluate Classifiers

  • ROC curve
  • Confusion matrix
  • Plot probability scores

Understand Your Models

  • Plot response 1D
  • Plot response 2D
  • Model signal
  • Segmented loss
  • Interactive flow

Primitive Operations

  • Using the primitives
  • Updating priors
  • Sample models
  • Fitting models
  • Pruning models
  • Visualise a model
  • Diverse models
  • Updating a QLattice
  • Validate data
  • Semantic types

Advanced

  • Converting a model to SymPy
  • Logging in Feyn
  • Setting themes
  • Saving a graph as an image
  • Using the query language
  • Estimating priors
  • Filtering models
  • Model parameters
  • Model complexity

Privacy & Commercial

  • Privacy
  • Community edition
  • Commercial use
  • Transition to Feyn 3.0

Saving and loading models

by: Kevin Broløs & Chris Cave
(Feyn version 3.4.0 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 QLattice in 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 feyn.

Example

Here is an example on how to save and load a model:

import feyn
from feyn.datasets import make_classification

# Generate a dataset and put it into a dataframe
train, test = make_classification()

# Instantiate a QLattice and run a classification simulation
ql = feyn.QLattice()
models = ql.auto_run(
    data=train,
    output_name='y'
)

# Save a model to a file
models[0].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)

Once a Model is saved and selected, you can load them into any Python environment to do predictions.

A loaded Model is no different from a Model sampled from the QLattice. For example, you can resume fitting a Model after loading it.

← Predicting with a modelCategorical features →
  • Example

Subscribe to get news about Feyn and the QLattice.

You can opt out at any time, and you can read our privacy policy here.

Copyright © 2024 Abzu.ai - Feyn license: CC BY-NC-ND 4.0
Feyn®, QGraph®, and the QLattice® are registered trademarks of Abzu®