Towards Quantum Machine Learning Hands-on
Machine Learning (ML) gained a lot of momentum in the last ten years, mostly thanks to the advancements in non-linear patterns discovery, and more specifically, in Deep Learning (DL). But those who think that DL is going to address all possible problems might be terribly wrong. DL and ML tasks, in general, are categorized as Non-Polynomial problems, which means that the number of possible solutions for a given problem can grow exponentially, making it intractable using the classical algorithmic approach. Here, Quantum Computing (QC) techniques have the potential to address these issues and help ML methods to solve problems faster and sometimes better than the classical counterpart. The conjunction of these two disciplines resulted in a new exciting research direction to explore: Quantum Machine Learning (QML).
2. whoami
@Docebo
calogero-zarbo-10467925 @calogerozarbo
Machine learning expert, passionate about biology, finance and quantum
computing. Currently on a mission to reduce the gap between research &
industry.
I am Calogero Zarbo
Machine Learning
Shallow learning, deep learning on time-series and Natural
Language Processing
Computational biology
Precision medicine, machine learning on genomics and
metagenomics
Quantum computing
Tackling the NP-hard part of machine learning algorithms,
taking advantage of quantum effects
3. Restricted Boltzmann
Machines
● Restricted as they can only
form bipartite graphs
● Hebbian nature:
○ Synaptic Plasticity
● Physical process involved:
○ Boltzmann distribution
○ Thermal equilibrium
○ Energy minimization
It’s an Energy Model
Image taken from stanford.edu
4. Physics: an exciting
challenge
● Nature optimization processes
● Biological processes mostly
occurs in the minimum energy
configuration
○ Protein folding
○ Biochemical reactions
An important role is played by
electrons’ minimum energy
configuration.
Roder et al.
5. From Physics to
Computer Science
● Combinatorial optimization is
crucial in machine learning
● Nature-inspired solutions are
always preferred if exists
● Main quantum phenomena:
○ Superposition
○ Entanglement
○ Tunnelling (Interference)
Image credits to uio.no
6. QC is Quantum Computing
Theoretical models:
● Gate model: IBM, Google
● Topological: Microsoft
● Adiabatic: D-Wave
All computationally equivalent:
● Found. Of Comp. Sci. (FOCS’04),
IEEE Comp. Soc., Washington, DC
(2004), pp.42-51
● Phys. Rev. Lett. 99, 070502
(2007)
Google image credit
7. D-Wave chip
architecture
● Qubits Energy minimization
problem is NP-hard
● NP-Hardness guarantees you
can map any practical problem
to the architecture (if you can
write it as a Quadratic
Unconstrained Binary
Optimization problem)
8. Superconducting QuBits
● Superconducting flux qubits
○ Qubit values is the direction
of circulating current
○ Clockwise &
counterclockwise
● Can manipulate bias Hi
to each
qubit
● Can apply a coupling Jij
between
certain pairs of qubits
9. ➔ Physicists will recognize this as an “Ising Hamiltonian”
➔ Mapped to a 0/1 variables via si
= 2xi
- 1
The General Problem
10. Let the system anneal in order to let the
qubits converge to the solution
Quantum Annealing
Read the spin configuration having low
energy, and map it into a bit-string
representing the nearly optimal solution
Read & Bitstring Map
Embed you objective function in the computational
graph
Problem Embedding
D-Wave System Overview
From the problem to the solution
11. Ising Hamiltonian
Transform the problem into
an Ising Hamiltonian
Run Computation
Let the QBits solve the problem
Search Problem
Find the NP general
root problem
Problem Embedding
Embed the Hamiltonian
in the Quantum Chip
Read Solution(s)
Read the set of
sub-optimal solution
Programming a Quantum Chip
14. Factoring for RSA Crypt
Evergreen example
● Find factors of an integer n
● Define a bit-wise multiplication
circuit that, given p and q,
computes n = p * q
○ Fix output at number to be
factored
○ If | n - p’ * q’ | == 0 then p’
and q’ are the factors
15. Radiotherapy treatment
optimization, brain tumors
Healthcare
Trading trajectory optimization,
market instability
Finance
Learning plan and Return on
Learning optimization
E-Learning
Query optimization, designing SAT
filters, factoring integers, finding
Ramsey numbers
Math & Physics
Application Fields
17. Get a set of training
examples X with
known belonging class
Y.
Detect the attributes
(features) of the
samples, also called
Weak Predictors
1 2 3 4
Combine the weak
predictors into a
Strong Predictor
Use Quantum Computing
to extract the
sub-optimal combination
Train a Binary Classifier
18. ➔ We model our input features as weak predictors
➔ Let wi
= 1 if the i-th predictor is part of the subset S* of the optimal
combination for the strong predictor, and 0 otherwise
➔ Use quantum annealing to find the optimal bitstring w, that minimize the
classification error.
➔ You can find serverless AWS Sagemaker QBoost implementation on medium
https://medium.com/@calogerozarbo88/take-off-with-quantum-machine-learning-2d31e95164ea
The Objective Function
20. Google’s Car Classifier
● Accuracy improvement 84%
→ 94%
● Google/D-Wave Qboost
implementation
● Less inference time
● Interesting Fact: The
trained model was brought
back to the classical
architecture
https://www.researchgate.net/publication/228933741_NIPS_2009_Demonstration_Binar
y_Classification_using_Hardware_Implementation_of_Quantum_Annealing
21. ➔ Starting from the baseline QUBO
➔ We want to minimize the same objective function
The math behind it
22. Higgs Boson Detection
● Features: 28 signals of the colliding
particles
● The signals were turned into a QUBO
model
● The Quantum Chip founds the
“optimal” set of signals to detect the
Higgs Boson
● A. Mott, et al. “Identifying the Higgs
Boson with a Quantum Annealer”
25. Optimal Trading
Trajectory
● Optimize large portfolios over
multiple timeframes
● Some assets can only be treated in
fixed-size blocks
● Rebalancing can be costly due to
transaction cost
● Goal: Maximize the net risk
adjusted performance taking
according the transaction cost
● Implementation: arXiv 1508.06182
[q-fin.CP]
26. ➔ Invest K chunks of $ in a set of N assets over multiple time steps T
➔ Objective function: maximize returns, taking into account risk, transaction cost
and market impact
➔ Variables encoding:
◆ Binary: Most efficient in number of variables;
◆ Unary: it allows representing of the largest integer
Formulation
31. QPU & CPU: Why does it work?
● While try to achieve the best solution possible it’s difficult to arrive to the
optimal in short time
● Classical methods only sense the neighborhood
● Quantum methods (tunnelling) can analyze a greater set of possible “better”
solutions
● Make the best next move possible (at least better than the classical)
32. The Hybrid Architecture
● Identify the the “Hard” part of the problem
● Create a Bit String Model
● Run the Model in the Quantum Chip → Simulation
● Score the output & Repeat
33. Healthcare:
Radiotherapy Optimization
Problem:
Deliver lethal dose of radioactive waves to
tumor avoiding the healthy tissues
Approach:
Hybrid QPU & CPU:
● Radiation plan
● Model Score
● Learn & Repeat
Outcome:
Reduced by over 30% the healthy tissues
damaged in 67% less time.
34. • Johnson et al. “Q. Annealing with Manufactured Spins”, Nature 473, 194-198,
May 2011
• T. Langting et al. “Entanglement in a Q. Annealing Processor”, Phys. Rev. X 4,
021041, 2014
• Boixo et al. “Computational multiqubit tunnelling in programmable quantum
annealers”, Nature Communications 7, Article Number: 10327, January 2016
• Albash et al. “Decoherence in adiabatic quantum computation”, Phys. Rev. A 91,
062320, 2015
Is it really Quantum?
36. Hybrid quantum-classical machine learning architecture:
• Restricted Boltzmann Machines, Auto-encoders, etc.
• Enable new quantum types of probabilistic graphical models:
○ Quantum Boltzmann Machines, etc.
QPUs are really good on Sampling which is the base operation for training
many probabilistic graphical models
Future Perspective
37. • Current approaches:
○ Supervised discriminative learning (mostly classifiers)
○ Neural Networks (Google Cloud, GPUs & TPUs)
• Other Approaches worth to explore:
○ Unsupervised generative learning → Key to AGI (Artificial General Intelligence)
D-Wave & IBM launched cloud based solutions to perform quantum computing.
For Machine Learning, D-Wave Leap is your choice
Do it Quantumly! In the
Cloud
38. • Quantum Revolution is approaching, better be ready!
• You don’t need to be a PhD in Physics to use it → (Python, C/C++, MatLab) API
• Is it worth? Depends, study well your particular problem first and check if similar
problem has been already mapped in a quantum version
Go make your hands dirty! D-Wave Leap and IBM Q Experience and try out the different
type of Quantum Computing. Join the communities, and fail as many times as you can.
Failing means trying, without trying there is no success.
Wrapping up