Quantum Machine Learning and Optimisation in Finance - Antoine Jacquier - E-Book

Quantum Machine Learning and Optimisation in Finance E-Book

Antoine Jacquier

0,0
37,19 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

With recent advances in quantum computing technology, we finally reached the era of Noisy Intermediate-Scale Quantum (NISQ) computing. NISQ-era quantum computers are powerful enough to test quantum computing algorithms and solve hard real-world problems faster than classical hardware.

Speedup is so important in financial applications, ranging from analysing huge amounts of customer data to high frequency trading. This is where quantum computing can give you the edge. Quantum Machine Learning and Optimisation in Finance shows you how to create hybrid quantum-classical machine learning and optimisation models that can harness the power of NISQ hardware.

This book will take you through the real-world productive applications of quantum computing. The book explores the main quantum computing algorithms implementable on existing NISQ devices and highlights a range of financial applications that can benefit from this new quantum computing paradigm.

This book will help you be one of the first in the finance industry to use quantum machine learning models to solve classically hard real-world problems. We may have moved past the point of quantum computing supremacy, but our quest for establishing quantum computing advantage has just begun!

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 484

Veröffentlichungsjahr: 2022

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Quantum Machine Learning and Optimisation in Finance

On the Road to Quantum Advantage

Antoine Jacquier

Oleksiy Kondratyev

BIRMINGHAM—MUMBAI

Quantum Machine Learning and Optimisation in Finance

Copyright © 2022 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

 

Senior Publishing Product Manager:Tushar Gupta

Acquisition Editor – Peer Reviews:Saby D’silva

Project Editor:Amit Ramadas

Development Editor:Bhavesh Amin

Copy Editor:Safis Editing

Technical Editor:Aniket Shetty

Proofreader:Safis Editing

Presentation Designer:Sandip Tadge

 

First published: October 2022

Production reference: 2170223

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK.

ISBN 978-1-80181-357-0

www.packt.com

To Loulou and the three musketeers

- A.J.

To my family and in memory of Viktor Yatsunyk

- OK

Foreword

As far as computational prospects (including hardware and software) and related developments are concerned, we live in the most exciting times. Every day brings new achievements, new promises, and, on occasion, new disappointments. Presently, some of the ideas discussed for decades are reaching the usable stage, the most exciting developments being thermonuclear fusion, all-purpose artificial intelligence, distributed ledger technology, and quantum computing. However, not surprisingly, breakthroughs in these fields are very hard to achieve, so, despite strenuous government and private efforts and lavish funding, their stated goals have not been reached yet.

Jacquier and Kondratyev, two of the strongest quants of their generation, have written a remarkable book about quantum computers and their applications in finance, emphasizing practical aspects of quantum machine learning and optimisation. To put the subject of this book in a proper context, let us briefly touch upon the history of computing devices. Without exaggeration, one can claim that the history of human progress is closely related to the history of computing devices. Original simple but beneficial instruments, such as abacuses, were invented at the dawn of civilization. Eventually, computing devices developed into potent tools, such as supercomputers, that define our day-to-day existence and future as species.

To start with, it is worth mentioning some milestones. Abacuses were used in Babylonia as early as c. 2700–2300 BC; eventually, they spread worldwide and became known as Roman abacuses. Computational devices were used together with memory devices, such as tally sticks and clay tablets. In classical antiquity, analog computers, such as the fabled Antikythera, probably intended for astronomical calculations, were actively used. Subsequently, medieval Muslim astronomers and engineers brought such devices to the next level. As a result, they developed remarkable objects, such as sundials, planispheres, and astrolabes.

Eventually, the center of progress moved to Europe and later to North America, where various calculating tools, such as the slide rule and mechanical calculator, were introduced in early modern times. However, the real breakthrough was achieved in 1804 when Jacquard created a loom programmable via punched cards. Babbage, “the father of the computer”, invented the first mechanical computer programmable with punch cards in the United Kingdom. Unfortunately, his Difference Engine and Analytical Engine were never completed because their execution involved severe practical issues, including insurmountable engineering obstacles, lack of funding, and general ridicule (Babbage’s story should serve as a fair warning to all the intrepid inventors who come with ideas centuries ahead of their time). Several decades later, the American inventor Hollerith was much more successful. He used punched cards to store data readable by a tabulator machine; IBM can trace its origins to these humble cards.

In the late 1800s to early 1900s, analog computers, such as tide-predicting machines, using physical phenomena to model the problem they were built to solve, became all the rage. Specifically, an analog computer’s developers must find physical processes governed by the same or similar equations as the problem of actual interest. Since, by design, such computers use noisy continuous values subject to various errors, they produce approximate solutions. However, such solutions are highly beneficial in many applications, including warfare, navigation, and economics, to mention but a few. One of the more remarkable examples of analog computers is the Phillips Hydraulic Computer, using simple tools to control the water’s flow to model the national economy of the United Kingdom with a 2% accuracy. Others are the battleship’s fire-control systems and bomb sights. Shortly before and during World War II, digital computers evolved into formidable competitors of analog computers and, by the 1950s, replaced them altogether, except for some highly specialized applications. Stemming from theoretical insights due to Turing, who invented the celebrated eponymous Turing Machine, and several other pioneers and practical engineering inventions, such as vacuum tubes and transistors, digital computers conquered the world. Initially, digital computers, such as the Ananasov-Berry computer, the Colossus, and the ENIAC, to mention but a few, were enormous machines built to serve military needs, including nuclear weapons design and cryptography. Eventually, computers found a wide plethora of commercial applications.

Modern digital computers store the necessary data in a magnetic memory in the form of 0-1 bits; they operate on this data via logical gates. The fact that the data is digitised has profound implications. On the one hand, while undeniably humongous, the amount of data a computer can store and the speed at which it can process this data are limited. On the other hand, inevitable errors inherent in any physical device are relatively easy to control.

Quantum computers were independently conceived in the early 1980s by Benioff, who proposed a quantum version of the Turing Machine, Feynman, and Manin. Feynman, with his usual eloquence, stated: “Nature isn’t classical, dammit, and if you want to make a simulation of nature, you’d better make it quantum mechanical, and by golly, it’s a wonderful problem because it doesn’t look so easy”. Quantum computers use quantum mechanical phenomena to solve computational problems that conventional computers cannot solve efficiently (or at all). To build a working quantum computer, one must overcome tremendous difficulties and achieve conditions such that quantum effects become dominant or, at least, noticeable. For example, such a computer must operate at low temperatures close to absolute zero. The primary distinction between quantum computers and their classical brethren is how they store and operate on the data. Instead of the 0-1 bits used by digital computers, quantum computers use the so-called qubits, capable of storing continuous information represented by a point on the so-called Bloch sphere; however, once measured, the data collapse to the classical 0-1 state. In theory, qubits should be entangled so that their quantum states depend on the state of all other qubits. The data, stored by a quantum computer, is processed via quantum gates. Since the data is continuous rather than discrete, the storage problem is not an issue per se; however, the continuity of the data makes quantum computers prone to inevitable errors. As a result, fault-tolerant quantum computing with suitably many qubits remains a very distant possibility. Furthermore, building an actual qubit is very difficult. Different possibilities have been tried, such as Josephson’s junctions, trapped ions, and many others.

Quantum computing has numerous exciting prospective goals, although it is unclear if all (or any) of them can be reached. The best known is cryptography, more concretely, factorising huge integers into prime factors using Shor’s algorithm, thus breaking conventional asymmetric encryption. It is worth mentioning that Shor’s algorithm is probabilistic; hence, it is particularly well adapted to quantum computers. The promise of achieving the factorisation breakthrough galvanised governments and private companies into pouring billions of dollars into quantum computing and related fields. For instance, the US government launched the National Quantum Initiative to explore and promote Quantum Information Science. In addition, the National Institute of Standards and Technology evaluates and standardizes quantum-resistant public-key cryptographic algorithms. However, the biggest number reliably factored by Shor’s algorithm is 35, factored in 2021 using a computer with very few qubits. Another exciting application is to search problems, which can be efficiently handled with Grover’s algorithm, although practical implementations are lacking. Several research groups, such as the Google-NASA collaboration, actively study machine learning applications. Nevertheless, large-scale applications are still far from being conquered.

This situation brings us back to the Jacquier and Kondratyev book. Given the relatively slow progress achieved in quantum computation, it is natural to go back to the early days of modern computing hardware and see if one can use a quantum-like computer as a modern analog computer; this is precisely what Jacquier and Kondratyev do. Specifically, rather than waiting for quantum computers to reach their top form, they advocate using quantum annealing computers and similar analog machines to perform the required calculations. Such computers start with a simple Hamiltonian with a known ground state and slowly (adiabatically) evolve the original Hamiltonian into the Hamiltonian of interest while always preserving the ground state. Thus, when the process is completed, the measurement allows one to find the ground state for the actual problem rather than a simplified one. Jacquier and Kondratyev use analog quantum computers to solve several exciting mathematical finance problems with verve and panache. Specifically, they discuss quantum boosting and demonstrate how to apply it to predict credit card defaults and solve classification problems. Subsequently, Jacquier and Kondratyev turn their attention to quantum Boltzmann machines and explain how to use them for distribution sampling.

Analog quantum computers can be used to solve many financial engineering problems. For instance, a quantum annealer is a perfect tool for solving the multi-period integer portfolio optimisation problem, which is NP-Complete. Monte Carlo simulations, which are fundamental for derivatives pricing and other related tasks, are particularly natural to perform using quantum computers since they can be viewed as true random number generators.

When it comes to the digital gate model quantum computing, Jacquier and Kondratyev discuss quantum neural networks and their applications to machine learning. Later, the authors cover Quantum Circuit Born Machine, Variational Quantum Eigensolver, and the Quantum Approximate Optimisation Algorithm. Finally, Jacquier and Kondratyev discuss new quantum algorithms, such as quantum kernels, Bayesian Quantum Circuit, Quantum Fourier Transform, and Quantum Monte Carlo Simulation.

Jacquier and Kondratyev are excited about quantum algorithms and their potential applications; however, they are not starry-eyed and approach quantum algorithms cautiously. Specifically, they put much effort into showing how classical algorithms can solve problems they are interested in and when quantum algorithms outperform their classical brethren.

While building quantum computers originally envisioned by Feynman and Manin might still be decades away, more practical analog quantum computers already exist. Experience suggests that finance is one of the fields where breakthroughs in computing tend to be used in real-time. Quants who want to use quantum algorithms in their day-to-day work could scarcely do better than starting their journey by studying this book.

Bon voyage!

Alexander Lipton and Marcos López de Prado, Abu Dhabi Investment Authority

Endorsements

Quantum Computing is often described as a transformative and disruptive technology. The potential is clear; however, currently, hardware does not yet offer the necessary performance to harness this potential. As the technology scales, four main problem types will become addressable. Simulation – in areas such as fluid dynamics, chemical catalysis, and structural biology; Machine Learning – in areas such as the use of AI in autonomous vehicles, personalised medicine, and fraud detection; Optimisation – in areas such as resourcing and logistics; and Cryptography – in areas of security and systems resilience.

In this book, Antoine and Oleksiy marry their expertise in mathematics and algorithm development with a deep understanding of and experience in global banking to address the problem types and current approaches in quantum-enabled machine learning and optimisation. Step by step, they take the reader through familiarisation with the methodology and mathematics of quantum mechanics and implementations of machine learning and optimisation in quantum annealers and gate model architectures. They describe both long-term, large-scale approaches and more practical, near-term NISQ-era variational and approximate techniques. Boston Consulting forecasts global financial services will see a $70-135bn impact from quantum computing in the coming two decades. $12.6tr of managed portfolio funds are located in the UK, with the UK finance sector contributing £132bn to the UK economy, employing over 1.1m people in 2019.

Recent surveys of UK business leaders suggest that 94% believe quantum computing will impact their organisation or sector significantly, and 72% intend to start strategic planning or create a pilot team by 2024. Only 6% have development teams in place today. In this book, Antoine and Oleksiy have created a toolkit to help focus development teams within the finance sector and beyond on the core areas of understanding and impact of quantum computing.

Demonstrating value through the application of quantum computing from the realms of physics and mathematics is a challenging one; nevertheless, the finance sector is an area ripe with computational challenges – particularly in machine learning and optimisation – that lend themselves both to business advantage and opportunities for quantum advantage.

—Dr. Michael N Cuthbert, Director, National Quantum Computing Centre

This book reviews different types of quantum computers as well as some important principles and algorithms. Quantum Machine Learning and Optimization in Finance is a great book to learn more about these two important applications of quantum computing.

—Dr. Ray O. Johnson, CEO, Technology Innovation Institute

The book is a wonderful guide for both the quantum computing scientist interested in understanding the applications of quantum computing in quantitative finance and the finance professional looking to explore the new computational tools offered by quantum computing.

Without giving up mathematical rigour, the authors manage to explain clearly and make order in the new and still growing discipline of quantum computing applied to quantitative finance.

This is no small feat, and the authors take us on a journey that starts from the foundations of quantum mechanics and leads to quantum annealing, gate-based quantum computing, and their algorithms. The journey never departs from the practical relevance of the subject to quantitative finance: several algorithms and numerical finance use cases and applications are developed explicitly and extensively.

Despite the complexity of the subject, the book is highly readable and successfully manages to illustrate and combine rigorous quantum computing methods with their numerous practical exemplifications in quantitative finance.

—Marco Paini, Director, Technology Partnerships Europe at Rigetti Computing

Jacquier and Kondratyev succeed in leading the reader on a journey through both foundational concepts and selected research material in a very pedagogical and pleasant way. By studying the book, readers will be well equipped to understand, formulate, and attack the main challenges of current quantum computing experiments applied to financial problems.

—Davide Venturelli, Ph.D., Associate Director of Quantum Computing, USRA

Contributors

About the authors

Antoine Jacquier graduated from ESSEC Business School before obtaining a PhD in Mathematics from Imperial College London.

His research focuses on stochastic analysis, asymptotic methods in probability, volatility modelling, and algorithms in quantum computing. He has published about 50 papers and has co-written several books. He is also the Director of the MSc in Mathematics and Finance at Imperial College and regularly works as a quantitative consultant for the Finance industry.

He has a keen interest in running and whisky.

I would like to thank all the people who challenged and motivated me in Applied Mathematics, asking the right questions, pointing to interesting problems, and proposing diverse solutions from many angles. Chief among them are Jim Gatheral, Peter Friz, Mathieu Rosenbaum, Josef Teichmann, Mark Davis, Claude Martini, and Aleksandar Mijatović, whose constant and generous ideas led to numerous advances in my career.

My journey through quantum computing, while not on the obvious path dictated by my mathematical background, started out of this scientific curiosity acquired over the years. I am indebted to Kostas Kardaras, Mugad Oumgari, Alexandros Pavlis, and Amine Assouel for crawling patiently with me through the dark meanders of quantum computing and quantum mechanics.

Oleksiy Kondratyev obtained his PhD in Mathematical Physics from the Institute for Mathematics, National Academy of Sciences of Ukraine, where his research was focused on studying phase transitions in quantum lattice systems.

Oleksiy has over 20 years of quantitative finance experience, primarily in banking. He was recognised as Quant of the Year 2019 by Risk magazine and joined Abu Dhabi Investment Authority as a Quantitative Research & Development Lead in the summer of 2021.

Outside the world of finance and quantum computing, Oleksiy’s passion is for sailing, in particular offshore racing. Oleksiy holds the RYA Yachtmaster Ocean certificate of competence and is a member of the Royal Ocean Racing Club.

I would like to thank Davide Venturelli for introducing me to the wonderful world of quantum computing. As a physicist, I am fascinated by the possibility of performing computation using quantum mechanical systems and as a quant, I appreciate the impact quantum computing will have on quantitative finance.

I am deeply grateful to Bill Winters for his support and interest in quantum computing. It takes both vision and courage to back the development of new emerging technology that does not promise immediate payoff but has the potential to change the finance industry as we know it.

Writing a book is a long journey and a result of many years of intensive research. This book would not have been possible without the discussions, collaborations, exchange of ideas, and support of Majed Al Romaithi, Bhavesh Amin, David Bell, Michael Brett, Kasper Christoffersen, Brian Coyle, Michael Cuthbert, Tushar Gupta, Max Henderson, Mark Hodson, Blanka Horvath, Wendy Huang, Ray Johnson, Elham Kashefi, Geoff Kot, Alexander Lipton, Charissa Liu, Marcos López de Prado, Aaron Lott, Alex Manson, Roger McKinley, Ashley Montanaro, Krzysztof Osiewalski, Marco Paini, Manos Papathanasiou, Amit Ramadas, Chad Rigetti, Christian Schwarz, Elena Strbac, Robert Sutor, Agnieszka Verlet, José Viñals, Colin Williams, Stefan Wörner, and Safis Editing.

About the reviewer

Gerhard Hellstern (Prof., Dr. rer. nat, graduate physicist, *1971) has been a professor at the Faculty of Economics at the Baden-Württemberg Cooperative State University in Ravensburg since 2018. From 1990 - 1995, he studied physics at the University of Tübingen and the State University of New York at Stony Brook; in 1998, he graduated as Dr. rer. nat. From 1998 to 2018, he was employed by several commercial banks and then for 17 years at Deutsche Bundesbank. He was in charge of the banking audits division for many years. Gerhard Hellstern has been involved in the application of data science methods (data analytics as well as machine and deep learning) in finance for many years. These methods also include Quantum Computing and Quantum Machine Learning. He is a Qiskit advocate at IBM and a member of the research network Quantum Computing of the Fraunhofer Gesellschaft. His current research focuses on applications of Quantum Computing / Quantum Machine Learning in the financial sector and beyond, and he has published several papers in this domain.

Join our book’s Discord space

Join our Discord community to meet like-minded people and learn alongside more than 2000 members at: https://packt.link/quantum

Table of Contents

Standard notations

Standard abbreviations

Preface

Chapter 1

:

The Principles of Quantum Mechanics

1.1

Linear Algebra for Quantum Mechanics

1.2

Postulates of Quantum Mechanics

1.3

Pure and Mixed States

Summary

Join our book’s Discord space

Part I:

Analog Quantum Computing – Quantum Annealing

Chapter 2

:

Adiabatic Quantum Computing

2.1

Complexity of Computational Problems

2.2

Principles of Adiabatic Quantum Computing

2.3

Implementations of AQC

2.4

Universality of AQC

Summary

Join our book’s Discord space

Chapter 3

:

Quadratic Unconstrained Binary Optimisation

3.1

Principles of Quadratic Unconstrained Binary Optimisation

3.2

Forward and Reverse Quantum Annealing

3.3

Discrete Portfolio Optimisation

Summary

Join our book’s Discord space

Chapter 4

:

Quantum Boosting

4.1

Quantum Annealing for Machine Learning

4.2

QBoost Applications in Finance

4.3

Classical Benchmarks

Summary

Join our book’s Discord space

Chapter 5

:

Quantum Boltzmann Machine

5.1

From Graph Theory to Boltzmann Machines

5.2

Restricted Boltzmann Machine

5.3

Training and Running RBM

5.4

Quantum Annealing and Boltzmann Sampling

5.5

Deep Boltzmann Machine

Summary

Join our book’s Discord space

Part II:

Gate Model Quantum Computing

Chapter 6

:

Qubits and Quantum Logic Gates

6.1

Binary Digit (Bit) and Logic Gates

6.2

Physical Realisations of Classical Bits and Logic Gates

6.3

Quantum Binary Digit (Qubit) and Quantum Logic Gates

6.4

Reversible Computing

6.5

Entanglement

6.6

Quantum Gate Decompositions

6.7

Physical Realisations of Qubits and Quantum Gates

6.8

Quantum Hardware and Simulators

Summary

Join our book’s Discord space

Chapter 7

:

Parameterised Quantum Circuits and Data Encoding

7.1

Parameterised Quantum Circuits

7.2

Angle Encoding

7.3

Amplitude Encoding

7.4

Binary Inputs into Basis States

7.5

Superposition Encoding

7.6

Hamiltonian Simulation

Summary

Join our book’s Discord space

Chapter 8

:

Quantum Neural Network

8.1

Quantum Neural Networks

8.2

Training QNN with Gradient Descent

8.3

Training QNN with Particle Swarm Optimisation

8.4

QNN Embedding on NISQ QPU

8.5

QNN Trained as a Classifier

8.6

Classical Benchmarks

8.7

Improving Performance with Ensemble Learning

Summary

Join our book’s Discord space

Chapter 9

:

Quantum Circuit Born Machine

9.1

Constructing QCBM

9.2

Differentiable Learning of QCBM

9.3

Non-Differentiable Learning of QCBM

9.4

Classical Benchmark

9.5

QCBM as a Market Generator

Summary

Join our book’s Discord space

Chapter 10

:

Variational Quantum Eigensolver

10.1

The Variational Approach

10.2

Calculating Expectations on a Quantum Computer

10.3

Constructing the PQC

10.4

Running the PQC

10.5

Discrete Portfolio Optimisation with VQE

Summary

Join our book’s Discord space

Chapter 11

:

Quantum Approximate Optimisation Algorithm

11.1

Time Evolution

11.2

The Suzuki-Trotter Expansion

11.3

The Algorithm Specification

11.4

The Max-Cut Problem

Summary

Chapter 12

:

The Power of Parameterised Quantum Circuits

12.1

Strong Regularisation

12.2

Expressive Power

Summary

Join our book’s Discord space

Chapter 13

:

Looking Ahead

13.1

Quantum Kernels

13.2

Quantum Generative Adversarial Networks

13.3

Bayesian Quantum Circuit

13.4

Quantum Semidefinite Programming

13.5

Beyond NISQ

Summary

Bibliography

Index

Other Books You Might Enjoy

Landmarks

Cover

Standard notations

Complex numbers

Hamiltonian

Identity operator

log

Natural logarithm

log2

Logarithm base 2

Natural numbers

Probability

𝒫

Projection operator (measurement operator)

q

Vector of binary variables, q := (q1,…,qN), (qi∈{0,1})i=1,…,N

Real numbers

s

Vector of spin variables, s := (s1,…,sN), (si∈{−1,+1})i=1,…,N

σαi

Pauli operator (α ∈{x,y,z}) acting on qubit i

u

Variable (scalar)

u

Column vector

u⊤

Transpose of a column vector

u∗

Complex conjugate of a column vector

|u⟩

Ket: column vector in Dirac notation

⟨u|

Bra: complex conjugate transpose of column vector in Dirac notation

⟨u|v⟩

Inner product

|u⟩⟨v|

Outer product

|u⟩⊗|v⟩

Tensor product

U

Matrix

U

Quantum logic gate

𝒰

Operator

𝒰†

Adjoint operator

⟨ψ|𝒰|ψ⟩

Expectation value of operator 𝒰 in state |ψ⟩

Standard abbreviations

AI

Artificial Intelligence

ANN

Artificial Neural Network

AQC

Adiabatic Quantum Computing

BQC

Bayesian Quantum Circuit

CD

Contrastive Divergence

CNN

Convolutional Neural Network

DBM

Deep Boltzmann Machine

DNN

Deep Neural Network

FN

False Negative

FP

False Positive

GA

Genetic Algorithm

GAN

Generative Adversarial Network

LSTM

Long Short Term Memory

ML

Machine Learning

MLP

Multi-Layer Perceptron

MPQC

Multilayer Parameterised Quantum Circuit

MPS

Matrix Product State

MPT

Modern Portfolio Theory

NISQ

Noisy Intermediate Scale Quantum

NP

Non-deterministic Polynomial

PDE

Partial Differential Equation

PDF

Probability Density Function

PQC

Parameterised Quantum Circuit

PSO

Particle Swarm Optimisation

QA

Quantum Annealing

QAO

Quantum Anharmonic Oscillator

QAOA

Quantum Approximate Optimisation Algorithm

QAML

Quantum Annealing for Machine Learning

QBM

Quantum Boltzmann Machine

QCBM

Quantum Circuit Born Machine

QCNN

Quantum Convolutional Neural Network

QFT

Quantum Fourier Transform

QGAN

Quantum Generative Adversarial Network

QHO

Quantum Harmonic Oscillator

QLS

Quantum Linear Solver

QLSTM

Quantum Long Short Term Memory

QMC

Quantum Monte Carlo

QML

Quantum Machine Learning

QNN

Quantum Neural Network

QPE

Quantum Phase Estimation

QPU

Quantum Processing Unit

QRAM

Quantum Random Access Memory

QSDK

Quantum Software Development Kit

QSDP

Quantum Semidefinite Programming

QUBO

Quadratic Unconstrained Binary Optimisation

QVA

Quantum Variational Autoencoder

RAM

Random Access Memory

RBM

Restricted Boltzmann Machine

ReLU

Rectified Linear Unit

SVD

Singular Value Decomposition

SVM

Support Vector Machine

TN

True Negative

TP

True Positive

TPQC

Tensor Network Parameterised Quantum Circuit

TTS

Time-to-Solution

VQE

Variational Quantum Eigensolver

 

Preface

Quantum Machine Learning – Most overhyped and underestimated field at the same time

Iordanis Kerenidis

Introduction

Why Quantum Computing? Quantum computing and AI will revolutionise and disrupt our society in the same way as classical digital computing did in the second half of the 20th century and the internet did in the first two decades of the 21st century.

Quantum computing (or, more generally, Quantum Information Theory) has been the subject of extensive research since the 1960s, but it was only in the last decade that progress on the hardware side has made it possible to test quantum computing algorithms; and it was only in the last several years that quantum computing’s supremacy was finally claimed as an experimental fact (i.e., a landmark experiment conducted on Google’s 53-qubit Sycamore quantum chip  [16]).

The story of quantum computing is, in this respect, similar to the story of AI: AI was born in the 1950s but then experienced two “winters”, when interest in AI and Machine Learning declined considerably (following the Lighthill report in the UK and the Speech Understanding Research debacle in the US in the 1970s, and the LISP collapse in the 1990s), before becoming widely used and adopted to the point that we can no longer imagine our life without it.

Even though we cannot rule out a “quantum computing winter” before quantum computing technology becomes embedded in everyday life to the same extent as the internet, smartphones, and AI, the whole range of quantum computing breakthroughs we have witnessed in the last few years makes it somewhat unlikely.

With recent advances in the field, we have finally reached the era of Noisy Intermediate-Scale Quantum (NISQ) computing  [237]. NISQ-era computers are powerful enough to test quantum computing algorithms and solve non-trivial real-world problems – and establish quantum speedup and quantum advantage over comparable classical hardware.

However, it is likely that the first real-world production-level business applications will be a hybrid quantum-classical protocol, where most of the computation and data processing is done classically, but the hardest problems are outsourced to the quantum chip. In finance, discrete portfolio optimisation problems, which are NP-hard, are such examples and clear objectives to tackle.

Why Quantum Machine Learning? It is a combination of quantum computing and AI that will likely generate the most exciting opportunities, including a whole range of possible applications in finance, but also in medicine, chemistry, physics, etc. We have already witnessed the first promising results achieved with Parameterised Quantum Circuits trained as either generative models (such as Quantum Circuit Born Machine, which can be used as a synthetic data generator) or discriminative models (such as a Quantum Neural Network that can be trained as a classifier). The possible use cases include market generators, data anonymisers, credit scoring, and the generation of trading signals.

All the models and techniques mentioned so far rely on the existence of universal, gate model quantum computers. However, there is another type of quantum hardware – quantum annealers – which realise the principle of adiabatic quantum computing. Quantum annealers are analog quantum computers that are very well suited for solving complex optimisation problems that are NP-hard for classical computers. Optimisation problems form a large class of hard-to-solve financial problems, not to mention the fact that many supervised and reinforcement learning tools used in finance are trained via solving optimisation problems (minimisation of a cost function, maximisation of reward).

An example of discriminative machine learning problems solved using quantum annealers includes building a strong classifier from several weak ones – the Quantum Boosting algorithm. The strong classifier is highly resilient against overtraining and against errors in the correlations of the physical observables in the training data. The quantum annealing-trained classifiers perform comparably to the state-of-the-art classical machine learning methods. However, in contrast to these methods, the annealing-based classifiers are simple functions of directly interpretable experimental parameters with clear physical meaning and demonstrate some advantage over traditional machine learning methods for small training datasets.

Another application of quantum annealing is in generative learning. In Deep Learning, a well-known approach for training a deep neural network starts with training a generative Deep Boltzmann Machine, typically using the Contrastive Divergence (CD) algorithm, then fine-tuning the weights using backpropagation or other discriminative techniques. However, generative training is often time consuming due to the slow mixing of Boltzmann (Gibbs) sampling. The quantum sampling-based training approach can achieve comparable or better accuracy with significantly fewer iterations of generative training than conventional CD-based training.

The main focus of this book is therefore on tackling practical real-world applications of Quantum Machine Learning (QML) algorithms executable on NISQ hardware rather than adopting the more traditional quantum computing textbook approach, diligently describing standard quantum computing algorithms (Shor’s, Grover’s, …), the quantum hardware demands of which are well beyond the capabilities of NISQ computers. The focus is also on the hybrid quantum-classical computational protocols that reflect the most productive way of harnessing the power of quantum computing – it is in tandem with classical computing that quantum computing solutions can provide maximum benefits to the users.

In this book, we cover all major QML algorithms that have been the subject of intensive research by the industry and that have shown early signs of potential quantum advantage. We also provide a balanced view of both analog and digital quantum computers and do not try to make a call on which quantum computing technology (superconducting qubits, trapped ions, neutral atoms, etc.) will be the eventual winner. The material is presented in a hardware-agnostic way with a strong emphasis on the fundamental characteristics of the algorithms rather than their hardware realisations, although we do not ignore the question of algorithms’ embedding and the practical limitations of the existing quantum computing hardware.

Why Finance? It is reasonable to expect that the incredibly fast rate of quantum hardware improvements we have witnessed over the last several years will lead to the widespread adoption of quantum computing techniques in finance. The finance industry is already investigating the potential of QML to solve classically hard practical problems and assist in achieving digital transformation. We might have moved past the point of quantum computing supremacy, but our quest to establish quantum computing advantage has just begun.

Quantitative finance is a discipline rich in interesting but computationally hard problems. Many such problems are interdisciplinary in nature and often require the transformation and adoption of mathematical and computational techniques developed in other fields. Here, we can mention, for example, the application of the theory of stochastic differential equations to option pricing  [226], methods of optimal control theory to management science and economics  [260], machine learning techniques to portfolio construction, and optimisation  [193].

This is why we turn to finance when we are looking for a wide range of real-world use cases to test (and improve!) quantum computing algorithms. The book provides many examples of the quantum computing techniques and algorithms applied to solving practical financial problems such as portfolio optimisation, credit card default prediction, credit approvals, and generation of synthetic market data. At the same time, the methods and techniques are formulated and presented in the most general form – we hope our readers will discover many new exciting quantum computing use cases in finance and beyond.

Who this book is for

The book is primarily aimed at three main groups: academic researchers and STEM students; finance professionals working in the field of quantitative finance and related areas; computer scientists and ML/AI experts. At the same time, the book is organised in such a way as to be accessible and useful to a much wider audience.

The book does not require any prior knowledge of quantum mechanics and the complexity of the mathematical apparatus should not feel intimidating: although we do not sacrifice mathematical rigour, the emphasis is very much on the understanding of the fundamental properties of the models and algorithms.

What this book covers

The book is split into two parts reflecting the natural progression from analog to digital quantum computing, with an increasing depth in the analysis and understanding of algorithms. However, we start with a chapter that covers the basic principles of quantum mechanics and provides the motivation for the computational methods based on those principles.

Chapter 1, The Principles of Quantum Mechanics, covers the basic mathematical principles of quantum mechanics. It provides the necessary definitions and discusses the postulates of quantum mechanics and their relevance to quantum computing.

Part I: Analog Quantum Computing – Quantum Annealing

For a number of years, quantum annealers were the only large-scale quantum computing devices available for experiments in solving non-trivial NP-hard combinatorial optimisation problems. Although quantum annealing specifically targets solving classically hard optimisation problems, it can also be used for many different hybrid quantum-classical problems, such as samplers and classifiers. The book provides detailed coverage of these applications and illustrates them on specific financial use cases.

Chapter 2, Adiabatic Quantum Computing, introduces the concept of analog quantum computing. The chapter starts with the principles of adiabatic quantum computing and proceeds with the quantum adiabatic theorem. The physical realisation of adiabatic quantum computing is quantum annealing, which is explained alongside its classical counterpart – simulated annealing. The chapter also discusses the implementation, limitations, and universality of adiabatic quantum computing.

Chapter 3, Quadratic Unconstrained Binary Optimisation, describes the single most important application of quantum annealing: solving classically hard optimisation problems. A wide range of combinatorial optimisation problems can be formulated as Quadratic Unconstrained Binary Optimisation (QUBO) problems (or, equivalently, as Ising problems) solvable on a quantum annealer. The chapter provides in-depth coverage of the forward and reverse quantum annealing techniques and demonstrates the power of quantum annealing on a discrete portfolio optimisation use case.

Chapter 4, Quantum Boosting, extends the range of QUBO applications beyond combinatorial optimisation and outlines the Quantum Boosting algorithm designed to combine a large number of weak classical classifiers into a strong classifier. The algorithm is formulated as a QUBO problem executable on a quantum annealer and applied to the use case of building a strong predictor of credit card defaults from a large number of weak predictors.

Chapter 5, Quantum Boltzmann Machine, explores further machine learning applications of quantum annealing. The Quantum Boltzmann Machine can be used as a generative model for sampling from a learned probability distribution as well as an efficient method of pre-training deep feedforward neural networks.

Part II: Gate Model Quantum Computing

Gate model quantum computing hardware has demonstrated enormous progress in recent years and is quickly approaching the quantum advantage threshold. The search for quantum advantage – the real-world productive application of a quantum computing solution that outperforms any viable classical alternative – is one of the strongest motivations for quantum computing research in finance and elsewhere. The book explores the main quantum computing algorithms implementable on existing NISQ devices and highlights a range of possible financial applications that may benefit from this new quantum computing paradigm.

Chapter 6, Qubits and Quantum Logic Gates, introduces the paradigm of gate model quantum computing. We start with the basic concepts of classical digital computing and expand the computational logic to accommodate the new principles of superposition and entanglement. The chapter draws parallels between and contrasts classical and quantum logic gates and shows how to assemble quantum circuits from individual quantum logic gates.

Chapter 7, Parameterised Quantum Circuits and Data Encoding, proceeds with the construction of quantum algorithms covering both the theoretical and the practical aspects of building Parameterised Quantum Circuits (PQCs), and demonstrates how classical samples can be encoded into quantum states processed by the PQCs. The chapter provides a detailed description of specific data encoding techniques.

Chapter 8, Quantum Neural Network, considers parameterised quantum circuits trained as classifiers. Throughout this chapter, we show how differentiable and non-differentiable learning algorithms can be used to efficiently train quantum neural networks. The chapter also discusses the limitations of existing QPUs and how to design quantum circuits that extract maximum benefit from the available quantum computing hardware. We investigate QNN performance on a credit approval use case and benchmark it against several standard classical classifiers.

Chapter 9, Quantum Circuit Born Machine, introduces a quantum counterpart to classical generative models such as Boltzmann Machines – the Quantum Circuit Born Machine (QCBM). The chapter starts with the definition of QCBM and how it can be efficiently configured and run on available QPUs, continues with the differentiable and non-differentiable learning and training procedures, and concludes with the market generator use case benchmarked against classical Restricted Boltzmann Machine.

Chapter 10, Variational Quantum Eigensolver, introduces the variational principle and formulates the Variational Quantum Eigensolver (VQE) approach to optimisation problems. The chapter discusses a hybrid quantum-classical approach to training the VQE and looks at the practical aspects of running it on NISQ devices.

Chapter 11, Quantum Approximate Optimisation Algorithm, describes the gate model quantum computing approach (inspired by quantum annealing) to solving QUBO-type problems, such as NP-hard Max-Cut optimisation problems.

Chapter 12, The Power of Parameterised Quantum Circuits, investigates the main sources of quantum advantage we expect to demonstrate on practical applications of parameterised quantum circuits. The chapter focuses on two elements: strong regularisation provided by quantum neural networks and the expressive power of quantum generative models.

Chapter 13, Looking Ahead, discusses new promising quantum algorithms and techniques such as the quantum kernel method, quantum GAN, Bayesian quantum circuit, and quantum semi-definite programming.

To get the most out of this book

This book is intended as an in-depth introduction to the power of quantum computing techniques for quantitative finance problems. While it is designed as self-contained, this book assumes that the reader has some familiarity with basic mathematical concepts in algebra, analysis, and computing. Knowledge of quantum mechanics is not required, and the main tools thereof shall be explained and made accessible to non-physicists.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: indicates code words in the text, software packages, folder names, path names, etc.

When we wish to draw your attention to a particular definition or notation, the relevant lines or items are set in either italic or bold.

Important remarks and conclusions are shown in boxes.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected], and mention the book’s title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you could report this to us. Please visit http://www.packtpub.com/submit-errata, select your book, click on the Errata Submission Form link, and enter the details.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visit http://authors.packtpub.com.

Share your thoughts

Once you’ve read Quantum Machine Learning and Optimisation in Finance, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and helps us deliver excellent content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere? Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily.

Follow these simple steps to get the benefits:

Scan the QR code or visit the link below:

https://packt.link/free-ebook/9781801813570

Submit your proof of purchase

That’s it! We’ll send your free PDF and other benefits to your email directly