Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Feyn: AI by Abzu

Feyn is a Python library that pushes machine learning to a new level by taking strong inspiration from quantum physics. A Feyn-model is based on the path integral formulation of quantum physics originally proposed by the American physicist Richard P. Feynman.

Feyn-model is in many ways similar to Neural Network (or Deep Learning) models, so some of the concepts may be familiar to you already. But at it's core, the Feyn-model introduces a new way to work with your data together with a revolutionary way to accumulate and transfer learnings.

But let's start with the basics.

To generate a Feyn-model you need access to a Qlattice, short for Quantum Lattice. A QLattice is a high-performance quantum simulator that runs on dedicated hardware. To learn more about getting access to a QLattice, visit www.abzu.ai

The other needed component is this Python package (feyn) that runs on your computer and accumulate learnings from your data. These learnings are communicated to your QLattice over the network.

A QLattice is the heart of a Feyn-model. The QLattice is divided into 2 different parts: the registers and the interactions.

The registers are what we use to interact with the QLattice. They are the input and output interface of a Feyn-model. There are different register types, but the basics are continuous and categorical. The output register is always continuous. More on this later.

The interactions layer is where the learnings are stored and is what we use to extract the QGraphs.

The QGraph represents all possible graphs, from the input registers to the output register. In human words that means all possible explanations for the given output with the given inputs, suggested by the qlattice.

Getting started: Feyn in 1 min

Ok, all this sounds good! But in practice how does this work?

Let us walk through a simple classification problem, step by step.

Create a blank QLattice.

from feyn import QLattice
ql = QLattice()
ql

Read the example dataset and add a register for each column in the dataset.

import sklearn.datasets
import pandas as pd

X, y = sklearn.datasets.load_breast_cancer(return_X_y=True)

in_registers = []
_data = {}

for i in range(X.shape[1]):
    label = 'inp_%i' % i
    _data[label] = X[:, i]
    in_registers.append(ql.add_register(label=label, register_type="cont"))

X = pd.DataFrame(_data)
out_reg = ql.add_register(label='out')

Now the QLattice is prepared for your problem.

Next, run for some epochs, where you retrieve a new QGraph, tune it, and update the QLattice with the learnings from the best graph.

The update calls will bias the QLattice from your learnings. Meaning that next time you call QLattice.get_qgraph, the QGraph will fit your problem better.

from sklearn.model_selection import train_test_split

X_test, X_train, y_test, y_train = train_test_split(X, y, test_size=0.33)

for _ in range(10):
    qgraph = ql.get_qgraph(in_registers, out_reg)
    qgraph.tune(X_train, y_train, epochs=10)
    best_graph = qgraph.graphs[0]
    ql.update(best_graph)

Finally, evaluate the results in the test dataset.

from feyn import tools

prediction = best_graph.predict(X_test)
tools.plot_confusion_matrix(y_true=y_test,
                                y_pred=prediction.round(),
                                title="Evaluation Results")

For a detailed tutorial about Feyn continue with:

  • Getting Started with Feyn
  • Building complex trainers

Installation

Feyn is available as python package distributed from PyPi server.

Requirements:

  • OS: Linux
  • Python 3.6, 3.7 or 3.8
  • Graphviz is used to draw charts (optional):
foo@bar:~$ sudo apt install graphviz

You can install it with the following command

foo@bar:~$ pip3 install feyn

Alternatively or if you don't have Linux OS you can use the jupyterlab Docker image.

foo@bar:~$ docker run -it --net=host abzu/jupyterlab:latest

adding the current folder as /data to the working directory.

foo@bar:~$ docker run -it --net=host -v $(pwd):/data abzu/jupyterlab:latest

Metadata

Release files for feyn 1.0.3.dev432

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for feyn 1.0.3.dev432
File Interpreter ABI Platform
feyn-1.0.3.dev432-cp38-cp38-macosx_10_15_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.15+ x86-64 Details
feyn-1.0.3.dev432-cp37-cp37m-macosx_10_15_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.15+ x86-64 Details
feyn-1.0.3.dev432-cp36-cp36m-macosx_10_15_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.15+ x86-64 Details

Total release size: 121.0 kB

Release files / feyn-1.0.3.dev432-cp38-cp38-macosx_10_15_x86_64.whl

Download URL feyn-1.0.3.dev432-cp38-cp38-macosx_10_15_x86_64.whl
Size 40.4 kB
Tags CPython 3.8 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
7fe44412d216b4457a1ba7537860e31ac849046bf05c1a953b5140470d9167e5
BLAKE2b-256 checksum
How to use checksums
b3db04bb7da9dd5bfb934da03f1318d17cedca994c99c18bffacd93c05a4e815
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release files / feyn-1.0.3.dev432-cp37-cp37m-macosx_10_15_x86_64.whl

Download URL feyn-1.0.3.dev432-cp37-cp37m-macosx_10_15_x86_64.whl
Size 40.3 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
73053528a75d4f1cebfda1cb74e3250d3c085936bf8c8408c2e443a0e3fb675e
BLAKE2b-256 checksum
How to use checksums
d0cce99358f54f073d8dc5ffbae9c8c64c285437dc21ca4b7c9245f0a1b26d50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release files / feyn-1.0.3.dev432-cp36-cp36m-macosx_10_15_x86_64.whl

Download URL feyn-1.0.3.dev432-cp36-cp36m-macosx_10_15_x86_64.whl
Size 40.3 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
f76a95ed7e563054b4bb9f0bbbeeb804ed521da041060c33d85e84227d6621b7
BLAKE2b-256 checksum
How to use checksums
0721e2fc7fb45a5ba097d65dae51d933e01c031eac31fd5e9529b99c603dd8f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release history Release notifications | RSS feed

3.5.0

26 release files

3.4.1

26 release files

3.3.1

22 release files

3.3.0

22 release files

3.2.0

22 release files

3.1.0

22 release files

3.0.6

22 release files

3.0.4

19 release files

3.0.3

19 release files

3.0.2

25 release files

3.0.1

25 release files

2.1.5

25 release files

2.1.4

25 release files

2.1.3

19 release files

2.1.2

26 release files

2.1.1

26 release files

2.1.0

26 release files

2.0.7

26 release files

2.0.0

24 release files

1.6.2

24 release files

1.5.6

24 release files

1.5.5

24 release files

1.5.4

24 release files

1.5.3

24 release files

1.5.2

24 release files

1.5.1

24 release files

1.4.9

24 release files

1.4.8

24 release files

1.4.7

24 release files

1.4.5

24 release files

1.4.4

24 release files

1.4.2

18 release files

1.3.3

18 release files

1.3.2

18 release files

1.2.1

18 release files

1.1.2

18 release files

1.1.1

12 release files

1.1.0

12 release files

1.0.3

12 release files

This release

1.0.3.dev432 This release

3 release files

1.0.2

6 release files

1.0.1

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page