Feyn Documentation

Feyn Documentation

  • Learn
  • Guides
  • Tutorials
  • API Reference
  • FAQ

›Understand Your Models

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

Model signal

by: Kevin Broløs and Chris Cave
(Feyn version 3.0 or newer)


The signal of a Model can be seen using the plot_signal function on the Model. This provides a graph visualisation of the Model that colours the nodes of the graph with its signal capture amount at each point.

Example

import feyn

from sklearn.datasets import load_diabetes
import pandas as pd

from feyn.tools import split

# Load diabetes dataset into a pandas dataframe
dataset = load_diabetes()
df_diabetes = pd.DataFrame(dataset.data, columns=dataset.feature_names)
df_diabetes['response'] = dataset.target

# Train/test split
train, test = split(df_diabetes, ratio=[0.6, 0.4])

# Instantiate a QLattice
ql = feyn.QLattice()

models = ql.auto_run(
    data=train,
    output_name='response'
)
# Select the best Model
best = models[0]
best.plot_signal(train)

Colours on a graph

The nodes in the graph returned from the plot_signal function are coloured and have values above them.

The values show the paths in the graph that are important or unnecessary in the Model. If the value of the node has increased significantly (about 0.05) compared to its inputs then those inputs are important. Otherwise the node is likely to be unnecessary.

If there is redundancy then run a simulation with lower max_complexity and with a criterion. You will get a Model with less unnecessary paths without sacrificing much on performance.

Repeating this process with many iterations enables you to decide the Model with the correct balance of interpreability and performance for your dataset.

The values are the Pearson's correlation coefficient of the activation values of the node and the output variable. The colours correspond to the correlation coefficient, where -1 is represented by red, 0 by white and 1 by green.


Parameters

data

This should be the data the model has trained on.

corr_func

Takes a correlation function amongst ['pearson', 'spearman', 'mutual_information'] to compute the correlations at each interaction in the model.

filename

Use to specify a path to a file to save the plot to (as SVG).

best.plot_signal(train, filename="feyn-signal-plot.svg")

Location in Feyn

This function can also be found in feyn.plots module.

from feyn.plots import plot_model_signal

plot_model_signal(best, train)
← Plot response 2DSegmented loss →
  • Example
    • Colours on a graph
  • Parameters
    • data
    • corr_func
    • filename
  • Location in Feyn

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®