Community

Have an existing GitHub repository or Jupyter notebook showing off quantum machine learning with PennyLane? Read the guidelines and submission instructions here, and have your demonstration and research featured on our community page.



Characterizing the loss landscape of variational quantum circuits

Patrick Huembeli and Alexandre Dauphin

30/09/2020

Using PennyLane and complex PyTorch, we compute the Hessian of the loss function of VQCs and show how to characterize the loss landscape with it. We show how the Hessian can be used to escape flat regions of the loss landscape.

Angle embedding in Iris classification with PennyLane's KerasLayer

Hemant Gahankari

09/11/2020

Using angle embedding from PennyLane, this demonstration aims to explain how to pass classical data into the quantum function and convert it to quantum data. It also shows how to create a PennyLane KerasLayer from a QNode, train it and check the performance of the model.


Amplitude embedding in Iris classification with PennyLane's KerasLayer

Hemant Gahankari

09/11/2020

Using amplitude embedding from PennyLane, this demonstration aims to explain how to pass classical data into the quantum function and convert it to quantum data. It also shows how to create a PennyLane KerasLayer from a QNode, train it and check the performance of the model.

Linear regression using angle embedding and a single qubit

Hemant Gahankari

09/11/2020

In this example, we create a hybrid neural network (mix of classical and quantum layers), train it and get predictions from it. The data set consists of temperature readings in degrees Centigrade and corresponding Fahrenheit. The objective is to train a neural network that predicts Fahrenheit values given Centigrade values.


Using a Keras optimizer for Iris classification with a QNode and loss function

Hemant Gahankari

09/11/2020

Using PennyLane, we explain how to create a quantum function and train a quantum function using a Keras optimizer directly, i.e., not using a Keras layer. The objective is to train a quantum function to predict classes of the Iris dataset.

Trainable Quanvolutional Neural Networks

Denny Mattern, Darya Martyniuk, Fabian Bergmann, and Henri Willems

26/11/2020

We implement a trainable version of Quanvolutional Neural Networks using parametrized RandomCircuits. Parameters are optimized using standard gradient descent. Our code is based on the Quanvolutional Neural Networks demo by Andrea Mari. This demo results from our research as part of the PlanQK consortium.


Quantum Machine Learning Model Predictor for Continuous Variables

Roberth Saénz Pérez Alvarado

16/12/2020

According to the paper "Predicting toxicity by quantum machine learning" (Teppei Suzuki, Michio Katouda 2020), it is possible to predict continuous variables—like those in the continuous-variable quantum neural network model described in Killoran et al. (2018)—using 2 qubits per feature. This is done by applying encodings, variational circuits, and some linear transformations on expectation values in order to predict values close to the real target. Based on an example from PennyLane, and using a small dataset which consists of a one-dimensional feature and one output (so that the processing does not take too much time), the algorithm showed reliable results.

A Quantum-Enhanced LSTM Layer

Riccardo Di Sipio

18/12/2020

In Natural Language Processing, documents are usually presented as sequences of words. One of the most successful techniques to manipulate this kind of data is the Recurrent Neural Network architecture, and in particular a variant called Long Short-Term Memory (LSTM). Using the PennyLane library and its PyTorch interface, one can easily define a LSTM network where Variational Quantum Circuits (VQCs) replace linear operations. An application to Part-of-Speech tagging is presented in this tutorial.