Quick start
by: Kevin Broløs & Tom Jelen
(Feyn version 3.0 or newer)
A Feyn tour around the block
Welcome to this quick guided tour. We'll get you set up and taking advantage of a QLattice
in no time.
Installation
Feyn
is available as Python3.8+ package through pip
. You can install it with the following command:
richard@feyn:~$ pip3 install feyn
Once installed, go to your preferred Python
environment and follow along with this example.
Instantiate a QLattice
If you're using a community QLattice
then get started with it by:
import feyn
ql = feyn.QLattice()
If you have paid for a license to use the QLattice
then here's a guide on how to set it up instead of using the community version.
Auto run
The quickest way to get started is to use the auto_run
function on the QLattice
. Below you can see how to use auto_run
function in a regression or a classification problem.
Regression
We can make a regression problem using feyn.datasets.make_regression
. Then we use the auto_run
function to find models for the dataset.
from feyn.datasets import make_regression
train, test = make_regression()
models = ql.auto_run(train, output_name = 'y')
This returns a list of fitted models that are the best the QLattice
has sampled, sorted by ascending loss.
Evaluate
The model with the lowest loss is models[0]
. We can evaluate that model with the plot
function and with plot_regression
.
best = models[0]
best.plot(train, test)
best.plot_regression(test)
Classification
We can make a classification problem using feyn.datasets.make_classification
. Then we use the auto_run
function to find models for the dataset. We use the kind
parameter to tell the auto_run
function we want classifier models.
from feyn.datasets import make_classification
train, test = make_classification()
models = ql.auto_run(train, output_name = 'y', kind = 'classification')
This returns a list of fitted models that are the best the QLattice
has sampled, sorted by ascending loss.
Evaluate
The model with the lowest loss is models[0]
. We can evaluate that model with the plot
function and it's ROC curve.
best = models[0]
best.plot(train, test)
best.plot_roc_curve(test)
Of course we've got way more in store for you, so take a dive off the deep end of the pool with the rest of our documentation.