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

Summary plot

by: Chris Cave
(Feyn version 3.0 or newer)

The summary of a Model can be seen using the plot function on the Model. This provides a graph visualisation of the Model with metrics and useful plots. The metrics and plots of the Model on the data passed are:

  • For regressors:
    • R2 score,
    • Root mean squared error,
    • Mean absolute error,
    • Regression plot,
    • Residuals plot.
  • For classifiers:
    • Accuracy at 0.5 threshold,
    • AUC,
    • Precision at 0.5 threshold,
    • Recall at 0.5 threshold,
    • ROC curve,
    • Confusion matrix at 0.5 threshold.

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(
    data=train,
    compare_data=test
)

Parameters

data

This should be the data the model has trained on.

compare_data

Can take a single dataframe to compare with, or a list of dataframes - in case you want to compare multiple datasets or splits with each other.

labels

You can pass in custom labels for the header of the summary metrics. If your list of labels is shorter than the compare_data argument, numbered labels will be generated for the rest.

filename

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

best.plot(train, filename="feyn-summary.html")

Location in Feyn

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

from feyn.plots import plot_model_summary

plot_model_summary(best, train)
← Visualise a modelSemantic types →
  • Parameters
    • data
    • compare_data
    • labels
    • filename
  • Location in Feyn
Copyright © 2022 Abzu.ai
Feyn®, QGraph®, and the QLattice® are registered trademarks of Abzu®