Feyn Documentation

Feyn Documentation

  • Learn
  • Guides
  • Tutorials
  • API Reference
  • FAQ

›Primitive Operations

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

Pruning models

by: Chris Cave & Jaan Kasak
(Feyn version 3.0 or newer)


The function feyn.prune_models removes redundant and poor performing Models from a list. It expects the list to be sorted by some metric. The best Model in the list is never removed.

Models get removed based on a decay function. A Model decays as a function of how many epochs it has been fitted and its performance compared to its peers. It will also remove models that are structurally identical from the list, leaving only the best performing one.

This prevents us fitting Models that are not going to improve any further.

This is typically used after fitting and prior to updating. This ensures we keep Models with high potential, conserve computational resources, as well breaking out of local minima.

Example

Continuing from the previous sections, we now add the prune_models function to our workflow.

import feyn
from feyn.datasets import make_classification

train, test = make_classification()

ql = feyn.QLattice()

models = ql.sample_models(train.columns, 'y', 'classification', max_complexity=10)

models = feyn.fit_models(models, train, 'binary_cross_entropy', 'bic', 4)

models = feyn.prune_models(
    models=models
)

Parameters of prune_models

models

This is the list of Models you want to remove the redundant and poor performing ones from.

keep_n

At most this many models will be returned. If keep_n is None, models are left to be pruned only by decay.

← Fitting modelsVisualise a model →
  • Example
  • Parameters of prune_models
    • models
    • keep_n

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®