Feyn

Feyn

  • Tutorials
  • Guides
  • API Reference
  • FAQ

›Understand Your Models

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

Model signal

by: 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.

Here is an example:

import feyn

from sklearn.datasets import load_boston
import pandas as pd

from feyn.tools import split

#Download boston housing dataset
boston = load_boston()
df_boston = pd.DataFrame(boston.data, columns=boston.feature_names)
df_boston['PRICE'] = boston.target

# Train/test split
train, test = split(df_boston)

# Instantiate a QLattice
ql = feyn.QLattice()

models = ql.auto_run(
    data=train,
    output_name='PRICE'
)
# 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 →
  • Colours on a graph
  • Parameters
    • data
    • corr_func
    • filename
  • Location in Feyn
Copyright © 2022 Abzu.ai
Feyn®, QGraph®, and the QLattice® are registered trademarks of Abzu®