Feyn Documentation

Feyn Documentation

  • Learn
  • Guides
  • Tutorials
  • API Reference
  • FAQ

›Advanced

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 parameters

by: Kevin Broløs & Meera Machado
(Feyn version 3.0 or newer)


You can output and inspect all parameters as a python dict using the params property on a Model. It's mostly useful for programmatic parsing and relies on the positional node orderings.

For other cases, we recommend you use the get_parameters function on the Model instead. It takes the name of the input or output and returns a pandas.DataFrame with its parameter values.

If your Model has multiple inputs with the same name in different positions, this is disambiguated with their ordinal position that you can cross-reference in the Model graph by checking the number in the corner of the node.

Example

Here is an example of how to display the parameters for a model that contains categorical and numerical inputs.

import pandas as pd
import feyn

ql = feyn.QLattice()

data = pd.DataFrame(
    {
        'a': [1, 2, 3, 4, 5, 6],
        'cat': ["Three", "Two", "Four", "Three", "Two", "One"],
        'y': [4, 4, 7, 7, 7, 7]
    }
)

models = ql.auto_run(data, output_name='y', stypes={'cat':'c'}, max_complexity=3, n_epochs=1)

best_model = models[0]
best_model

Parameters of 'cat'
Parameters of 'a'
Parameters of 'y'
best_model.get_parameters(name='cat')
cat
category
Four 0.376742
Three 0.143783
Two -0.089089
One -0.321966
best_model.get_parameters(name='a')
a
scale 0.400000
scale_offset 3.500000
w 0.582286
bias 0.993797
detect_scale 0.000000
best_model.get_parameters(name='y')
y
scale 1.500000
scale_offset 0.000000
w 2.862249
bias 0.572713
detect_scale 0.000000

Location in Feyn

This function can also be found in the feyn.tools module.

from feyn.tools import get_model_parameters

get_model_parameters(best_model, 'cat')
← Filtering modelsModel complexity →
  • Example
  • 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®