Feyn

Feyn

  • Tutorials
  • Guides
  • API Reference
  • FAQ

›Essentials

Getting Started

  • Quick start
  • Using Feyn
  • Installation
  • Transition to Feyn 3.0
  • What is a QLattice?
  • Community edition
  • Commercial use

Essentials

  • Auto Run
  • Visualise a model
  • Summary plot
  • Semantic types
  • Categorical features
  • Estimating priors
  • Model parameters
  • Predicting with a model
  • Saving and loading models
  • Filtering models
  • Seeding a QLattice
  • Privacy

Evaluate Regressors

  • Regression plot
  • Residuals plot

Evaluate Classifiers

  • ROC curve
  • Confusion matrix
  • Plot probability scores

Understand Your Models

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

Primitive Operations

  • Using the primitives
  • Updating priors
  • Sample models
  • Fitting models
  • Pruning models
  • Diverse models
  • Updating a QLattice
  • Validate data

Advanced

  • Converting a model to SymPy
  • Setting themes
  • Saving a graph as an image
  • Using the query language
  • Model complexity

Visualise a model

by: Chris Cave
(Feyn version 3.0 or newer)

All Models can be visualised as a directed graph. Inputs are on the left hand side and the output is on the right hand side. Each node represents a mathematical transformation and the activation values move from left to right.

If you are in a Jupyter environment then a Model automatically displays as a graph.

import feyn

ql = feyn.QLattice()
models = ql.sample_models(['Hello', 'World'], 'Bonjour!','classification')

models[0]

If you want to update the display within a Jupyter cell then you can use the show_model function.

for model in models[0:5]:
    feyn.show_model(
        model=model,
        update_display=False
    )

If update_display=False then the previous Model will not be cleared and the next Model will be displayed beneath it.

A typical case to use this function is when you're making your own custom workflow with the primitive operations and you want to see the best Model in the current epoch of the fitting loop.


In an IPython environment, you'll be able to hover over each of the interactions to get a tooltip with the internal state of it - such as the weights, biases and encodings.

Showing progress during training

If you're using the primitives, you might want to use the label under the model to display some progress information. feyn.tools.get_progress_label gives the default display that is also used in auto_run. It takes the current epoch and max epochs, and an optional elapsed time in seconds and model count, if you want to display information about progress and estimate time to completion.

Example:

ql = feyn.QLattice()

n_epochs = 10
model_count = 0
elapsed = 0

from time import time
start = time()

for epoch in range(1, n_epochs+1):
    models = ql.sample_models(['Hello', 'World'], 'Bonjour!','classification')

    # Actual fitting and updating not displayed here

    model_count += len(models)
    elapsed = time() - start
    models[0].show(
        label = feyn.tools.get_progress_label(epoch, n_epochs, elapsed_seconds = elapsed, model_count = model_count)
        update_display=True
    )

A model with a label displaying elapsed time and model count

← Auto RunSummary plot →
Copyright © 2023 Abzu.ai
Feyn®, QGraph®, and the QLattice® are registered trademarks of Abzu®