Feyn Documentation

Feyn Documentation

  • Learn
  • Guides
  • Tutorials
  • API Reference
  • FAQ

›Essentials

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

Predicting with a model

by: Kevin Broløs & Chris Cave
(Feyn version 3.4.0 or newer)


A Model that has been fitted can be used to perform predictions on a dataset.

An example model that adds two inputs together could look like this:

iris graph

A regressor outputs values within the range of the output variable.

A binary classifier outputs values between 0 and 1. These are the probabilities of the samples belonging to the positive class. This can be rounded to get a discrete prediction of 0 or 1.

Requirements

The data you want to predict for should:

  • be a pandas.DataFrame or pandas.Series;
  • contain the inputs present in the Model.

Any additional columns in the DataFrame that are not inputs to the model will be automatically ignored, so you don't have to filter the dataset beforehand.

Example

Here is an example of using the predict function.

import feyn
from feyn.datasets import make_classification

# Generate a dataset and put it into a dataframe
train, test = make_classification()

# Instantiate a QLattice and run a classification simulation
ql = feyn.QLattice()
models = ql.auto_run(
    data=train,
    output_name='y'
)

# Select the best model and predict
best = models[0]

# Predicting on a DataFrame
best.predict(test)

# Predicting on a Series
best.predict(test.iloc[0])

The predict function returns a np.array of predictions.

Further exploration

For guides on how to evaluate a model, check out regression plot for regressors and ROC curve for classifiers.

← Seeding a QLatticeSaving and loading models →
  • Requirements
  • Example
  • Further exploration

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®