Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Introduction to Quantum Computing and Topics about Quantum-Assisted Machine Learning Through D-Wave

1 Introduction and Preperation

Quantum computing is one approach to obtain answer that classical conventional computer cannot easily handle or intractable at all. Using the power of superposition and entanglement (will explain later) of quantum system, quantum algorithms have the potential to provide speed-up (exponential or quadratic) over classical algorithms. For now, the existing quantum devices are not identified as universal quantum computer, but have their own advantages over conventional computers. The topic about quantum-assisted machine learning is also drawing attentions from different aspects.

1 .1 Qubit

In general, any two-level quantum system can be treated as qubit, which can be in either quantum state of 0|0\rangle and 1|1\rangle. Similar to classical bits (eg. on/off, high voltage/low voltage as 0/1), there are lots of systems that can realize such quantum systems such as the spin of atoms or electrons (up/down), or the occupation number of fermions in optical lattices (0/1). Quantum computing methods have pointed into different directions like trapped-ion, electron on helium, optical lattices, and photonic.

We mentioned the states 0|0\rangle and 1|1\rangle as :

0=(10)1=(01)| 0 \rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} \qquad |1 \rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}

ψ| \psi \rangle is called a “ket” and ϕ\langle \phi | is called a “bra”. They are related through i=i\langle i | = | i \rangle^\dagger . These states form an orthonormal basis of the Hilbert space ij=δi,j\langle i | j \rangle = \delta_{i,j}. These are all part of the Dirac Notation, which you can learn more about in Chapter 1.

1.2 Pauli Matrices

The Pauli matrices, defined as below, is a set of unitary (UU=UU=IU U^\dagger = U^\dagger U = \mathcal{I}) and Hermitian (U=UU^\dagger = U) 2×22\times2 complex matrices.

σx=(0110)σy=(0ii0)σz=(1001)\sigma_x = \begin{pmatrix} 0 & 1 \\1 & 0 \end{pmatrix} \qquad \sigma_y = \begin{pmatrix} 0 & -i \\i & 0 \end{pmatrix} \qquad\sigma_z = \begin{pmatrix} 1 & 0 \\0 & -1 \end{pmatrix}

It is straight-forward that 0|0\rangle and 1|1\rangle are the eigenstates of Pauli-Z matrix σz\sigma_z, i.e. σz0=0\sigma_z |0\rangle = |0\rangle and σz1=1\sigma_z |1\rangle = - |1\rangle

The expectation value of an operator in specific state can be calculated as iOi\langle i | O | i \rangle. An Hermitian operator has a real expectation value, (iOi)=iOi=iOi(\langle i | O | i \rangle)^* = \langle i | O^\dagger | i \rangle = \langle i | O | i \rangle, and we call it an observable.

1.3 Superposition of quantum states

One quantum state can be written as the superposition of other quantum states with complex coefficients. The interpretation is to represent this state in another orthonormal space.

ψ=iαiϕi|\psi\rangle = \sum_i \alpha_i |\phi_i \rangle

with iαi2=1\sum_i |\alpha_i|^2 =1. αi2|\alpha_i|^2 is the probability that the system is in the particular state ϕi|\phi_i \rangle.

Another important set of states to know is the superposition of 0| 0 \rangle and 1| 1 \rangle , shown as

+=12(0+1)=12(01)| + \rangle = \frac{1}{\sqrt{2}} \left( |0\rangle + |1\rangle \right) \qquad | - \rangle = \frac{1}{\sqrt{2}} \left( |0\rangle - |1\rangle \right)

which are eigenstates of Pauli-X matrix.

1.4 Bloch Sphere

The bloch sphere is one way to visualize the state of one qubit. A general state of one qubit can be written as,

ψ=cos(θ/2)0+sin(θ/2)eiϕ1| \psi \rangle = \cos(\theta/2) | 0 \rangle + \sin(\theta/2) e^{i \phi} | 1 \rangle
from IPython.display import Image 
Image ("blochsphere.png", width=500)
<IPython.core.display.Image object>

where the +| + \rangle and |- \rangle states sit on the X-axis. Chapter 2 looks a little deeper into qubits, states, and the bloch sphere.

1.5 Entanglement

Entanglement is a quantum feature of a system of multiple qubits. A entangled state cannot be separated, which means the system cannot be expressed as two independent subsystem.

ψψAψB| \psi \rangle \neq | \psi_A \rangle \otimes | \psi_B \rangle

One example of entangled states is a Bell state:

ψ=12(0A0B+1A1B)| \psi \rangle = \frac{1}{\sqrt{2}} \Big( | 0_A 0_B \rangle + | 1_A 1_B \rangle \Big)

1.5.1 Density operator and von Neumann entropy

The density operator is useful to describe a statistical system in general. It has the definition as

ρ=inpiψiψi\rho = \sum_i^n p_i | \psi_i \rangle \langle \psi_i |

where n1n \ge 1, and pip_i is the probability of being in the state of ψi| \psi_i \rangle. When n=1n=1, the system is consider a pure state, or a mixed state otherwise. The trace of a density matrix is always one tr(ρ)=1tr(\rho)=1, and a pure state also satisfies the condition that ρ=ρ2\rho = \rho^2.

The von Neumann entropy is defined as,

SvN(ρ)=tr(ρlnρ)S_{vN}(\rho) = - tr(\rho \ln \rho)

and it is easy to prove that the entropy of a pure state is zero.

The entropy of a subsystem is also related to measure entanglement to the rest of the system. To obtain the density matrix of a subsystem, we can “trace over” the rest of the system (sometime called environment). Consider a system ρ\rho, consists two subsystem A and B.

ρA=trB(ρ)=jdim(B)ϕjρϕj\begin{align} \rho_A &= tr_B (\rho) \\ &= \sum_j^{dim(B)} \langle \phi_j | \rho | \phi_j \rangle \end{align}

HW: Prove a non-entangled state, in the form of ψ=ψAψB| \psi \rangle = | \psi_A \rangle \otimes | \psi_B \rangle, has a density operator of the subsystem A as ρA=ψAψA\rho_A = | \psi_A \rangle \langle \psi_A |, and the entropy is zero.

For an entangled state like a Bell state, ψ=12(0A0B+1A1B)| \psi \rangle = \frac{1}{\sqrt{2}} \Big( | 0_A 0_B \rangle + | 1_A 1_B \rangle \Big), the density operator of system is:

ρ=ψψ=12(0A0B0A0B+0A0B1A1B+1A1B0A0B+1A1B1A1B)ρA=0Bρ0B+1Bρ1B=12(0A0A+1A1A)\begin{align} \rho &= | \psi \rangle \langle \psi | \\ &= \frac{1}{2} \left( | 0_A 0_B \rangle \langle 0_A 0_B| +| 0_A 0_B \rangle \langle 1_A 1_B| +| 1_A 1_B \rangle \langle 0_A 0_B| +| 1_A 1_B \rangle \langle 1_A 1_B| \right) \\ \rho_A &= \langle 0_B | \rho | 0_B \rangle + \langle 1_B | \rho | 1_B \rangle \\ &= \frac{1}{2} \left( | 0_A \rangle \langle 0_A | + | 1_A \rangle \langle 1_A | \right) \end{align}

thus, the von Neumann entropy is SvN(ρA)=1/2ln(1/2)1/2ln(1/2)=ln2S_{vN}(\rho_A) = - 1/2 \ln (1/2) - 1/2 \ln (1/2) = ln 2. Learn about entangled states vs. product states and more in Chapter 3.

1.6 Quantum Gates

1.6.1 Single-qubit gates

A unitary matrix acts on one qubit is called single-qubit operation, or single-qubit gate. It is considered a rotation of a vector on Bloch sphere, transfer the state vector to a new position. For example, the Hadamard gate, expressed as below, transfer between 0+| 0 \rangle \leftrightarrow | + \rangle, and 1| 1 \rangle \leftrightarrow | - \rangle

H=12(1111)H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}

which can be consider as a rotation with respect to 4545^\circ axis on X-Z plane.

Applying a gate that is unitary and Hermitian twice in a row will always gives you the identity matrix, and this feature can be used to simplify the circuit to prevent error of implementation.

1.6.2 Two-qubit gates

The operation acts on two qubits are always commonly used in quantum circuits. Utilizing two-qubit gates and single-qubit gates, an arbitrary quantum operation on multiple qubits can be approximated to an arbitrary accuracy, and those sets of gates are considered universal. One type of two-qubit gates plays an important role, controlled gate. A controlled gate, using one qubit as the control qubit and determine an operation on the target state. The operation will apply to the target state only if the control qubit is in 1|1\rangle

cU0a=0acU1a=1Ua{}^{c}U|0a\rangle = |0a\rangle \qquad {}^{c}U|1a\rangle = |1\rangle U|a\rangle

I will introduce one important two-qubit gate, controlled-Not gate (CNOT).

CNOT0a=0aCNOT1a=1aˉ\rm{CNOT} | 0 a \rangle = | 0 a \rangle \qquad \rm{CNOT} | 1 a \rangle = | 1 \bar{a} \rangle

HW: Try to prepare a Bell state mentioned above on two qubit, using CNOT. What about a quantum operation that swap the state of two qubit?

1.7 Quantum Circuits

Quantum circuits represent a set of sequential quantum gates on qubits to perform quantum computation.

Image("ibm_qAdder.png")
<IPython.core.display.Image object>

Here is an example of a transpiled quantum half-adder from IBM Quantum Platform Modules. For a broader overview of Quantum Circuits & Gates, take a look at Chapter 4 Summary.

1.8 IBM Quantum Experience

The IBM Quantum Platform is an open resource for the public where people can learn quantum computing and building quantum circuits like legos, where you can learn how to build circuits like the one above. IBM also has their Introduction to Qiskit and IBM Quantum, where they teach you how to use their hardware. By using Qiskit, people have access to either their 156 or 127 qubit computers.

2 Hamiltonian Model

Aside from a quantum circuit, another model that we can use to conduct quantum computing is the Hamiltonian model. From the Schrodinger equation with time-independent Hamiltonian H:

itψ=H^ψi \hbar \frac{\partial}{\partial t} | \psi \rangle = \hat{H} | \psi \rangle

we can consider the system is undergoing a unitary transformation:

ψ(t)=exp(iH^t)ψ(0)| \psi(t) \rangle = \exp \big(-\frac{i}{\hbar} \hat{H} t\big) | \psi(0) \rangle

For a time-dependent Hamiltonian H(t), the system will undergo a path instead of an arc in Hilbert space.

HW: what is the corresponding equation of motion of density matrix described by the Schrodinger equation?

2.1 Adiabatic Quantum Computing (AQC)

Adiabatic quantum computing is based on the adiabatic theorem of quantum mechanics, stating that if the initial state is one of the eigenstate of initial Hamiltonian, the system will remain in that eigenstate if the system undergoes small perturbation. In another expression, if the system is time-dependent and changing slowly that the difference can be treated as perturbations, the system will remain in instantaneous eigenstate of this Hamiltonian.

For example, if the system is in the ground state (lowest energy state) of Hamiltonian H(0), as the Hamiltonian H(t) changes slowly enough, the system is always be in ground state. Here the fidelity is defined as F(a,b)=ab2F(| a \rangle, | b \rangle ) = | \langle a | b \rangle | ^2.

## Example of adiabatic state transformation

import numpy as np
from numpy import linalg as LA
from scipy.linalg import expm
import matplotlib.pyplot as plt
%matplotlib inline 

T_total = [1, 2, 10]
dt = 0.001

px = np.matrix([[0,1],[1,0]])
pz = np.matrix([[1,0],[0,-1]])
psi0 = np.matrix([1/np.sqrt(2),1/np.sqrt(2)])
psi0 = psi0.T

for T_tot in T_total:
    q = int(T_tot/dt)
    F = np.zeros(q)
    time_step = np.zeros(q)
    phi = psi0
    for i in range(q):
        H = (1-(i+1)/q)*px + (i+1)/q*pz  
        phi = expm(-1j*H*dt)*phi
        E , VE = LA.eig(H)
        F[i] = (np.absolute(VE[:,0].T*phi))**2
        time_step[i] = i*dt
 
    plt.plot(time_step,F)

In this example, the time-dependent Hamiltonian is written as a linear interpolation of initial Hamiltonian and final Hamiltonian, which is straight-forward and commonly used, but not optimized. The AQC requires several conditions:

  1. The initial state is easy to prepare

  2. The time-dependent Hamiltonian is well-defined

  3. The changing speed of Hamiltonian shall be slow As shown above, if the changing speed is too fast (total ramping time is to short), the final state is far away from correct answer. Depending on the answer encoded in the target quantum state, the AQC can obtain the correct answer for large system problems.

This technique can also be used to prepare a required state for further experiments, known as the adiabatic state preparation.

However, the feature of system staying in the eigenstates can be hard to handle. During the ramping, if the system is excited to another eigenstate, it can be trapped in that state and therefore results in a poor fidelity. An open question is to determine an optimal ramping (other than linear interpolation) with minimal knowledge.

2.2 Quantum annealing and D-Wave system

Quantum computing devices have developed at a fast rate in the past few years, showing promising possibilities. For a quantum computer to be practical, it needs to meet certain requirements:

  1. The ability to increase the number of qubits (Scalable Quantum Computer)

  2. Qubits can be well prepared into a arbitrary state (initial condition)

  3. Longer decoherence times than gate implementation time (long life-time of system to perform reasonable number of operations)

  4. Universal Gate Set

  5. The ability to retrieve classical information from qubits

Depending on which of these or other factors that are favored, there are different options that can be chosen from. For instance, a quantum system designed to solve specific problems are usually called a quantum simulator. In this case, we will introduce the quantum annealer from D-Wave for quantum assisted/enhanced machine learning.

2.2.1 The Hamiltonian of D-Wave system

The core of the D-Wave system is the AQC. The system has a well defined Hamiltonian as:

Hdw(t)=A(t)iaiσxi+B(t)(ibiσzi+i,jcijσziσzj)H_{dw}(t) = A(t) \sum_i a_i \sigma_x^i + B(t) \left( \sum_i b_i \sigma_z^i + \sum_{i,j} c_{ij} \sigma_z^i \sigma_z^j \right)

with time-dependent function A(t),B(t)A(t), B(t) to control the initial Hamiltonian and final Hamiltonian. In their system, A(0)B(0)A(0) \gg B(0), and at the “end”, A(T)B(T)A(T) \ll B(T).

With the initial quantum state ++...+| + + ... +\rangle , which is the ground state of iaiσxi\sum_i a_i \sigma_x^i, the B(t)B(t) is tuned up so the system will undergo adiabatic ramping into the ground state of ibiσzi+i,jcijσziσzj\sum_i b_i \sigma_z^i + \sum_{i,j} c_{ij} \sigma_z^i \sigma_z^j.

In another word, this system is designed to find the minimal value of an energy(cost) function of so-call Ising model:

Eising=ibiSi+i,jcijSiSjE_{ising} = \sum_i b_i S^i + \sum_{i,j} c_{ij} S^i S^j

where Si{1,+1}S^i \in \{-1, +1\}

Users have the control of input data (bi,cijb_i, c_{ij}), and obtain corresponding configurations and energies with desired number of read-outs.

The energy function can be rewritten with a transformation S=2t1S = 2t -1 to have a so-called quadratic unconstrained binary optimization (QUBO) format:

EQUBO=ibiti+i,jcijtitjE_{QUBO} = \sum_i b'_i t^i + \sum_{i,j} c'_{ij} t^i t^j

where ti{0,1}t^i \in \{0, 1\}. This energy function covers a commonly used cost function in machine learning:

E=ibiviicihii,jwijvihjE = -\sum_i b_i v^i - \sum_i c_i h^i - \sum_{i,j} w_{ij} v^i h^j

where vi,biv^i, b_i are the visible nodes and bias, hj,cjh^j, c_j are the hidden nodes and bias, and wijw_{ij} are weights. For a system with n bits, the Hilbert space is 2^n dimensional, and grows exponentially with the system size. In this situation, it is hard to find the ground state efficiently or the conventional classical computer might face memory issue.

2.2.2 Features of D-Wave system

As mentioned previously, the D-Wave system is designed to find a configuration which minimize a certain cost function, where the conventional computer finds intractable for large system. The information retrieved from D-Wave calculations are classical (configurations of +1/-1 or 0/1 with the corresponding energy). Another feature of D-Wave is the sampling probability is of Boltzmann distribution, i.e.:

P(Ei)=1Zexp(βEi)Z=iexp(βEi)\begin{align} P(E_i) &= \frac{1}{\mathcal{Z}} \exp (- \beta E_i) \\ \mathcal{Z} &= \sum_i \exp (-\beta E_i) \end{align}

Different from the physical definition of β=1/kBT\beta = 1/k_{B} T, the β\beta here is corresponding to an effective temperature, or can be considered as a rescaling of energy.

This feature of sampling can help dealing with Restricted Boltzmann machine (RBM) of large system size (large number of visible and hidden nodes).

2.3 Review of RBM

The RBM a generative stochastic artificial neural network that can learn a probability distribution over its set of inputs. It is indeed a powerful tool for many problems like supervised learning and clustering. A bipartite graph without connections between same layer (shown below) is demonstrating “restricted” Boltzmann machine.

Image("RBM.png")
<IPython.core.display.Image object>

The joint probability distribution of v,hv,h is defined by a Gibbs distribution

P(v,h)=1Zexp(E(v,h))P(v,h) = \frac{1}{\mathcal{Z}} \exp(-E(v,h))

where

E(v,h)=inbiviimcihii,jn,mwijvihjE(v,h) = -\sum_i^n b_i v_i - \sum_i^m c_i h_i - \sum_{i,j}^{n,m} w_{ij} v_i h_j

with nn visible nodes and mm hidden nodes. The partition function is

Z={v,h}exp(E(v,h))\mathcal{Z} = \sum_{\{v,h\}} \exp (-E(v,h))

the forward and reverse conditional probability distributions for an RBM are both simple sigmoid functions:

P(hj=1v)=sigm(cj+iwijvi)P(vi=1h)=sigm(bj+iwijhj)P(h_j=1 | v) = sigm(c_j + \sum_i w_{ij} v_i) \\ P(v_i=1 | h) = sigm(b_j + \sum_i w_{ij} h_j)

With a fixed training data V, the gradient of the log-likelihood with respect to the weights is:

logPwij=vihjdatavihjmodel\frac{\partial \log P}{\partial w_{ij}} = \langle v_i h_j \rangle_{data} - \langle v_i h_j \rangle_{model}

The first term is the clamped expectation with V fixed and can be calculated efficiently. The second term is the expectation value over the joint probability distribution function mentioned before:

vihjmodel=1Z{v,h}vihjexp(E(v,h))\langle v_i h_j \rangle_{model} = \frac{1}{\mathcal{Z}} \sum_{\{v,h\}} v_i h_j \exp (-E(v,h))

This term is hard to obtain due to the difficulty of sampling all the configurations, Contrastive Divergence is used to compute the expectation value from model and to update the weights and biases.

2.4 Quantum assisted process

Combine the need from RBM and the feature from D-Wave sampling, the quantum annealer can be used to compute the expectation value from training model. It is easy to implement this process as the interface of D-Wave library is well connected with Python. The QUBO to feed in to the D-Wave can be defined as:

Q=1β(BW0C)Q = \frac{1}{\beta}\begin{pmatrix} B & W \\ 0 & C \end{pmatrix}

where BB and CC are diagonal matrices with bib_i and cic_i. β\beta is undetermined. The D-Wave will return configurations of vectors in (n+m)(n+m) dimension, (v,h)(v,h). Then the expectation value, vihjmodel\langle v_i h_j \rangle_{model} , can be calculated as,

vihjmodel=1NrnNrvi(n)hj(n)\langle v_i h_j \rangle_{model} = \frac{1}{N_r}\sum_n^{N_r} v_i^{(n)} h_j^{(n)}

When tackling a large system, the D-Wave sampling might be performing better calculations.

Example

D-Wave has updated their TOS and does not provide API keys to new users, but we are going to instead use dimod, which is a python library used for building Binary Quadratic Models (BQMs). Dimode is part of the D-Wave Ocean SDK. With it, we are going to translate the energy model of a RBM into a QUBO formulation.

Starting with the tools we’ll use:

import sys
import numpy as np
import dimod
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker

For the RBM parameters, we’ll use a 2 visible and 2 hidden RBM.

SymbolMeaningShape
bvisible biases(n_vis,)
chidden biases(n_hid,)
Wweight matrix(n_vis, n_hid)
betainverse temperature — scales the QUBOscalar
b = np.array([0.5, -0.3])  #our 2 visible 
c = np.array([0.2, 0.4] )   #our 2 hidden 
W = np.array([[0.8, -0.5],[0.3, 0.6]])  #our weights

beta = 1.0

n_vis, n_hid = len(b), len(c)
n_total = n_vis + n_hid

print(f"Visible nodes : {n_vis}")
print(f"Hidden nodes  : {n_hid}")
print(f"Total QUBO variables : {n_total}")
Visible nodes : 2
Hidden nodes  : 2
Total QUBO variables : 4

With that set, we can start to build the QUBO matrix. Using the formula from 2.4, we can map the RBM energy function onto a QUBO as:

Q=1β[diag(b)W0diag(c)]Q = \frac{1}{\beta} \begin{bmatrix} \text{diag}(b) & W \\ 0 & \text{diag}(c) \end{bmatrix}

Variables are ordered as [v0,v1,,h0,h1,][v_0, v_1, \ldots, h_0, h_1, \ldots]

We can visualize the RBM as below

Image("rbm_visualization.png")
<IPython.core.display.Image object>
Q_mat = np.zeros((n_total, n_total))

for i in range(n_vis):
    Q_mat[i, i] = b[i] / beta

for j in range (n_hid):
    Q_mat[n_vis + j, n_vis + j] = c[j] / beta

for i in range(n_vis):
    for j in range(n_hid):
        Q_mat[i, n_vis + j] = W[i, j] / beta

Q_dict = {
    (i, j): Q_mat[i, j]
    for i in range(n_total)
    for j in range(i, n_total)
    if Q_mat[i, j] != 0
}

print("QUBO matrix Q (upper triangular, scaled by 1/beta):")
print(np.round(Q_mat, 3))
print(f"\nNon-zero entries in Q_dict: {len(Q_dict)}")
QUBO matrix Q (upper triangular, scaled by 1/beta):
[[ 0.5  0.   0.8 -0.5]
 [ 0.  -0.3  0.3  0.6]
 [ 0.   0.   0.2  0. ]
 [ 0.   0.   0.   0.4]]

Non-zero entries in Q_dict: 8

We can visualize this as a heat map as shown below.

Image("qubo_matrix.png")
<IPython.core.display.Image object>

With the QUBO setup, we can start to train the RBM. To do this, we need to know the probability of nodes being active together when the network is allowed to freely settle into its thermal equilibrium.

n_reads = 1000

sampler = dimod.SimulatedAnnealingSampler()
response = sampler.sample_qubo(Q_dict, num_reads=n_reads)

samples = np.array([[s[i] for i in range (n_total)] for s in response.samples()])

print(f"Samples collected : {samples.shape[0]}")
print(f"Variables per sample : {samples.shape[1]}")
print(f"\nFirst 5 samples (columns = [v0, v1, h0, h1]):")
print(samples[:5])
Samples collected : 1000
Variables per sample : 4

First 5 samples (columns = [v0, v1, h0, h1]):
[[0 1 0 0]
 [0 1 0 0]
 [0 1 0 0]
 [0 1 0 0]
 [0 1 0 0]]

With the RBM trained, we can now compute the model expectation.

vihjmodel=1Nrn=1Nrvi(n)hj(n)\langle v_i h_j \rangle_{\text{model}} = \frac{1}{N_r} \sum_{n=1}^{N_r} v_i^{(n)} h_j^{(n)}

Since both are binary, this equals the fraction of samples where both viv_i and hjh_j were simultaneously active.

v_samples = samples[:, :n_vis]   
h_samples = samples[:, n_vis:]   

vh_expectation = (v_samples[:, :, None] * h_samples[:, None, :]).mean(axis=0)

print("Model expectation <v_i h_j>_model:")
print(np.round(vh_expectation, 4))

for i in range(n_vis):
    for j in range(n_hid):
        print(f"  <v{i}, h{j}> = {vh_expectation[i,j]:.4f}  "
              f"(both active in {vh_expectation[i,j]*100:.1f}% of samples)")
Model expectation <v_i h_j>_model:
[[0.06  0.158]
 [0.127 0.118]]
  <v0, h0> = 0.0600  (both active in 6.0% of samples)
  <v0, h1> = 0.1580  (both active in 15.8% of samples)
  <v1, h0> = 0.1270  (both active in 12.7% of samples)
  <v1, h1> = 0.1180  (both active in 11.8% of samples)

This output is our model expectation, or vihjmodel\langle v_i h_j \rangle_{\text{model}}. Even though we can’t run this on a quantum computer directly, we can still run the math and get a close result with dimod. You can try changing the biases to see how you can get closer to a value you want.

3 Summary and Outlook

Here we introduced fundamental concepts of quantum computation of circuit model and Hamiltonian model. Later, we build connection between machine learning and existing quantum devices for a quantum assisted process. There are lots of open questions about quantum computing and potential applications.