High level Python interface to abzu qlattice
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file feyn-1.0.3-cp38-cp38-manylinux2014_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 113.1 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 498cbddcded72b618285b63082baa077d060bd833bac3a10071970e54fa63aae |
|
MD5 | 5f91e1c458f898f40ce2244a3e261ee0 |
|
BLAKE2b-256 | 50756af54b2087b44a740856e80824bd706e652262130e99ef2e61fad7d3d456 |
File details
Details for the file feyn-1.0.3-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 113.1 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d0a5365ebd5af75718d43d2475a17b439837412b1f0cef1f8bacc6b07656752 |
|
MD5 | fb3c056637ce60d10aa7b2276d85001c |
|
BLAKE2b-256 | 37b74def7c50d68e1e6c10c87e656d53ef49ef60f6514bcaa5d2defc1ee5d35a |
File details
Details for the file feyn-1.0.3-cp38-cp38-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp38-cp38-macosx_10_15_x86_64.whl
- Upload date:
- Size: 42.0 kB
- Tags: CPython 3.8, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99587157d8cd50436686f061e68a8b59c424d4ebba026791b185666f91958174 |
|
MD5 | 2799cf3be97ca155af2923e71774ea26 |
|
BLAKE2b-256 | 208a4d852e91f549de775846a26a92acd9e738a3b91b395e115a574b81bb0b29 |
File details
Details for the file feyn-1.0.3-cp38-cp38-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp38-cp38-macosx_10_14_x86_64.whl
- Upload date:
- Size: 41.9 kB
- Tags: CPython 3.8, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | edecbde5b8c0e098332ff2ce68d60f4796d827d7a9668de5e7ab8de6789d6551 |
|
MD5 | 40351a94be5702719a75d3b741716d3e |
|
BLAKE2b-256 | 856fa14f7d2d6ae1685ceb34c2a92c017e61644d67ede28ad8fb9e38fb5feb2a |
File details
Details for the file feyn-1.0.3-cp37-cp37m-manylinux2014_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp37-cp37m-manylinux2014_x86_64.whl
- Upload date:
- Size: 114.3 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f9cc187b29d9e0a31f4c13de669b1467b6fcfee51962cdf94474bd06e42fd2d |
|
MD5 | 667d4e3d85996f22f0c37e367a46739c |
|
BLAKE2b-256 | 5f4d843452df866aed029302f42b401d928434c626d594b1f41274f6177ed2a5 |
File details
Details for the file feyn-1.0.3-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 114.2 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f2dd1a210dffc38604b759d6ecf6db1762a6ff60430d359aa2572be6f97150d |
|
MD5 | 791fe6479de1ffe113860fedf7e6f97e |
|
BLAKE2b-256 | 494850f73c411d5de852652e2012dc0342a3bf6173f1f5bd14ebd892475f94c6 |
File details
Details for the file feyn-1.0.3-cp37-cp37m-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp37-cp37m-macosx_10_15_x86_64.whl
- Upload date:
- Size: 41.9 kB
- Tags: CPython 3.7m, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8b3375b3ea8548a2bceaff83bb900964fb2ef8ce2cdff8eb03e8405ae6f179b |
|
MD5 | b1245f638c0bae7939793ef2ba4162e9 |
|
BLAKE2b-256 | 3af302a3c5cd506f70660f05893fe1cdeae46b4fbda28bf3e8f34c5ceb52eddb |
File details
Details for the file feyn-1.0.3-cp37-cp37m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp37-cp37m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 41.8 kB
- Tags: CPython 3.7m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb38281be2608084d255b297c8f731a6e8a81c2d0c022e8a0d8b89858530141a |
|
MD5 | 8d10f69a7b6c1b8875333eaf08f3b572 |
|
BLAKE2b-256 | 6c286cb626548b97c5b5eedb0fe6d423f6445c2f1d7e67d0949aae02dbbde1b7 |
File details
Details for the file feyn-1.0.3-cp36-cp36m-manylinux2014_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp36-cp36m-manylinux2014_x86_64.whl
- Upload date:
- Size: 109.9 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc13f22b986749fc5fc7a0c7e9f26d7915cc17f22a3e6ce1c428e85e1280d816 |
|
MD5 | 1c6a2ae87dcc494ff06489ba4cb65af0 |
|
BLAKE2b-256 | c90c1bd61c8d6f7671ed684ac300e629e09b5911c471d974ea004bfffb57f97a |
File details
Details for the file feyn-1.0.3-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 109.9 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f81ca069b318d8c088394652434536c18ec2ab9481d4cb33c2bddf2d3af4d4d1 |
|
MD5 | 8e0f402b1cedc82e8b53383a1481e6b0 |
|
BLAKE2b-256 | e5ce90c2309f51b11b5a805f7f31ef8e8e66d785becc72a3db6ed03e0de5c764 |
File details
Details for the file feyn-1.0.3-cp36-cp36m-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp36-cp36m-macosx_10_15_x86_64.whl
- Upload date:
- Size: 41.9 kB
- Tags: CPython 3.6m, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d98ab9a333f0f8c58a429f1f67a6df0b64543ac8c688bbebfcfb8937689f3c52 |
|
MD5 | 261abf61a414c85ba417de396f13cff8 |
|
BLAKE2b-256 | 592757dfebeb55bede2dbe875786cdcc5b458f75df4d3c90b6dc188ab5cf1f59 |
File details
Details for the file feyn-1.0.3-cp36-cp36m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: feyn-1.0.3-cp36-cp36m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 41.8 kB
- Tags: CPython 3.6m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66adff85709610cd499f36515a947c153cea8c096130fff050542e2bdb32df41 |
|
MD5 | 09240deaae30fdb9626fd3b866f5fd15 |
|
BLAKE2b-256 | 6bba53a87efbc1e4eb0aa189248aee98d7af740b050978fc922febc2e9dad1c6 |