31
Quantum Bayesian Inference Quantum Bayesian Inference Michal Grabowski Marcin Przewięźlikowski Institute of Computer Science, AGH, al. Mickiewicza 30, 30-059 Kraków, Poland {przewiez,mgrabow}@student.agh.edu.pl May 29, 2019

Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

  • Upload
    others

  • View
    22

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian Inference

Quantum Bayesian Inference

Michał Grabowski Marcin Przewięźlikowski

Institute of Computer Science, AGH, al. Mickiewicza 30, 30-059 Kraków, Poland{przewiez,mgrabow}@student.agh.edu.pl

May 29, 2019

Page 2: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian Inference

Agenda

1 IntroductionBayesian NetworksNon-cooperative gamesQuantum games

2 Usage of Bayesian Networks in quantum gamesQuantum Bayesian theoryInference algorithms and their quantum extensions

3 Overview of AcausalNets.jlthe Julia language

4 Experiments with Monty Hall game5 Summary

Page 3: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceIntroductionBayesian Networks

What are Bayesian Networks?

Classically

graphical (directed, acyclic)probabilistic models

vertices - random variables(events) with givenprobabilities of occurences

edges - conditionaldependence of variables oneach other

Figure: An example classicalBayesian Network

Page 4: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceIntroductionBayesian Networks

Use cases of Bayes Nets

Inferencewhat is the chance of raining?what is the chance that my grass is going to be wet givenit rains?what is the chance that it was cloudy given my grass iswet but my sprinkler wasn’t working?

Structure and parameter learning (irrelevant to this talk)Given historical data on clouds, rain, sprinkler activity and thewetness of grass I can learn things like:

clouds cause rain (not the other way around)grass tends to be wet more often when it rains

Page 5: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceIntroductionNon-cooperative games

The motivation - non-cooperative games

multiple players compete with each otherplayers employ strategies in order to win - those strategiesmust account for the rules of the game, as well as theopponents

Nash EquilibriumNo player can benefit by changing his strategy while the otherplayers keep theirs unchanged.More formally, if σ∗ is a strategy profile being Nashequilibrium, then for every player i and every strategy σi , thepayoff function for player i satisfies: ui(σ∗) ≥ ui(σi , σ

∗−i)

Page 6: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceIntroductionNon-cooperative games

Example - Monty Hall game

two players - Player and theHost

three closed doors with aprize behind one of them

after the Player’s first choiceof the door, the Host opensone of the remaining twodoors, to reveal that it isempty

the Player can then altertheir original choice

in classical case, the Playerhas 2

3 chance of winning byaltering their choice

Figure: three choices the Playercan make

Page 7: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceIntroductionQuantum games

Beyond classical strategies - quantum games

Research suggests that generalizing to quantum games mayyield optimal strategies superior to the classical ones in gamessuch as Monty Hall [Kurzyk and Glos, 2016] and Prisoner’sDilemma [Eisert et al., 1999, Szopa, 2013].

Quantum gameis a generalization of its classical version and can bereduced to ituses concepts from quantum computing, unavailable inclassical versionyields results unavailable in its classical version

Page 8: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceUsage of Bayesian Networks in quantum games

Bayesian Networks help us model games

events in a game can bemodeled as a Bayesnetworkprobability distributionsof events reflect theplayers’ strategiesthrough Bayesianinference, variousscenarios and outcomesof the game may beanalyzed

Figure: A classical BayesianNetwork modelling the MontyHall game

Page 9: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceUsage of Bayesian Networks in quantum games

Quantum Bayesian networks

possibility of an acausalconnection - some of the variablesin the network are entangleda system of entangled variables inthe network must be describedwith joint probability distribution(in this example - ρAB)distributions of participants ofsuch systems can be calculated,but they don’t tell the completestory

Figure: States ofsystems A and B areentangled (zigzag line),and there is classicdependence of C on Aand B (arrows).

Page 10: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceUsage of Bayesian Networks in quantum gamesQuantum Bayesian theory

Quantum probability operators I

A classical distribution σA of a discrete random variable A canbe generalized by a density operator ρA ∈ L(HA), where:

ρA = ρ†AρA ≥ 0,Tr(ρa) = 1L(H) is a set of linear operators on complex Hilbert spaceH

Generalizing classical to quantum probabilityσV = [p0, p1, ..., pn−1]pi - probability of thei-th state∑N−1

i=0 pi = 1

|i〉 - vector representingthe i-th stateρV = ∑N

i=1 pi |i〉〈i | -density matrix

Page 11: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceUsage of Bayesian Networks in quantum gamesQuantum Bayesian theory

Quantum probability operators IIDensity matrices of quantum superpositions

|ψ〉 = α|0〉+ β|1〉

|α|2 + |β|2 = 1

ρψ = |ψ〉〈ψ| =(|α|2 αβαβ |β|2

)

Classical mixture of N quantum states|ψi〉 - a quantum state achieved with probability pi

ρψ =N∑

i=1pi |ψi〉〈ψi |

Page 12: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceUsage of Bayesian Networks in quantum gamesQuantum Bayesian theory

Generalizing Bayesian theory to the quantumrealm IJoint probability distribution of a system of variables

ρAB ∈ L(HAB) = L(HA ⊗HB) - joint distribution of (A,B)ρA = TrB(ρAB) - partial tracing

? operator

X ? Y = Y 12XY 1

2

X ,Y ∈ L(H)

non-commutativenon-associative

ConditionalityB conditionally dependent on AρB|A ∈ L(HAB)TrB(ρB|A) = IAIA - an identity operator ∈ L(HA)ρAB = ρB|A ? (ρA ⊗ IB)

Page 13: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceUsage of Bayesian Networks in quantum gamesQuantum Bayesian theory

Generalizing Bayesian theory to the quantumrealm II

Applying evidenceKnowledge that the actual state of A is |a〉 transforms ρAB into

ρA=a,B = (|a〉〈a| ⊗ IB)ρAB(|a〉〈a| ⊗ IB)(|a〉〈a| ⊗ IB)ρAB

(1)

Page 14: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceUsage of Bayesian Networks in quantum gamesInference algorithms and their quantum extensions

Inference in Bayes Nets

Inference in Bayesian Networks is an NP-hard problem[Kwisthout, 2015].

Naive algorithmGiven a Bayes Net with variables [1, ...n]:

1 compute the joint probability of the whole net:

ρV1,...,Vn = ?ni=1(I1 ⊗ I2 ⊗ ...Ii−1 ⊗ ρi ⊗ Ii+1 ⊗ ...⊗ In) (2)

2 apply evidence (if any) using (1)3 trace the result to obtain the desired joint probability

Exponential memory complexity!

Page 15: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceUsage of Bayesian Networks in quantum gamesInference algorithms and their quantum extensions

Belief Propagation algorithm I

1 network is converted to a tree structure ("Junction tree")2 each vertex in a tree contains a subset of variables from

the network with partially initialized probabilities3 evidence is applied4 vertices pass "messages" between each other in order to

gain full knowledge about the state of the tree

Steps (1) and (2) are identical regardless of whether thenetwork is classical or quantum. In step (3) equations formessages with quantum states slightly differ in quantumversion.We are still researching a correct implementation of thequantum version of the algorithm.

Page 16: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceUsage of Bayesian Networks in quantum gamesInference algorithms and their quantum extensions

Belief Propagation algorithm II

(a) A Bayes net (b) Moralization of the graphand building a clique of thevariables we’re infering

Page 17: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceUsage of Bayesian Networks in quantum gamesInference algorithms and their quantum extensions

Belief Propagation algorithm III

(c) Triangulation of the graph(d) Clique of the triangulatedgraph become vertices of thejunction tree

Figure: Building an optimal junction tree

Page 18: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceUsage of Bayesian Networks in quantum gamesInference algorithms and their quantum extensions

Belief Propagation algorithm IVKnowledge gathering by vertex W

W updates the knowledge about its state by gathering"messages" from its neighbors in the tree

ρW = 1Y · µW ?

∏v∈neighbors(W )

mv→W

mv→u carries the knowledge about the state of variablesshared by v and u from v ’s perspective

mv→u = 1Y Tru(µv ? [(

∏v ′∈neighbors(v)/u

mv ′→v) ? νv :u])

knowledge is gathered recursively by the vertex containingthe variables we want

Page 19: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceOverview of AcausalNets.jl

AcausalNets.jl

a Julia (1.0) library supporting inference in a quantumgeneralization of Bayesian networksavailable on GitHub:

https://github.com/mikegpl/AcausalNets.jl

the repository also contains usage examples in a form ofJupyter Notebooks

https://github.com/mikegpl/AcausalNets.jl/tree/master/notebooks

M. Przewiezlikowski, M. Grabowski, D. Kurzyk and K.Rycerz "Support for high-level quantum Bayesianinference" accepted for ICCS 2019 12-14 June, Faro,Portugal.

Page 20: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceOverview of AcausalNets.jl

Implementation details I

Our goals

simplicity of computations

abstracting out as much math as possible

extendability of the library

Functionalities

defining random variables, systems of random variables

building Bayesian networks as graphs with systems as vertices

performing inference

naive algorithm works for all networkswe are still working on belief propagation for quantumnetworks

Page 21: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceOverview of AcausalNets.jl

Implementation details IIListing 1: Defining variables, systems and Bayesian network in AcausalNets.jl� �

# discrete variablesvar_a = Variable ( :a , 3)var_b = Variable ( :b, 3)var_c = Variable ( : c , 3)# distr ibut ionsroA = diagm(0 => [1/3,1/3,1/3] )roB = diagm(0 => [1/3,1/3,1/3] )roCwAB = diagm(0 =>[0,1/2,1/2, 0 ,0 ,1 , 0 ,1 ,0 ,

0 ,0 ,1 , 1/2,0 ,1/2, 1 ,0 ,0 ,0 ,1 ,0 , 1 ,0 ,0 , 1/2,1/2,0 ] )

# variable systemssys_a = DiscreteQuantumSystem( [var_a] , roA)sys_b = DiscreteQuantumSystem( [var_b] , roB)sys_c_ab = DiscreteQuantumSystem( [var_a , var_b] , [ var_c ] , roCwAB)# defining the networkan = AcausalNet()push! (an, sys_ab)push! (an, sys_c_ab)� �

Page 22: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceOverview of AcausalNets.jl

Implementation details III

Figure: Submodules of AcausalNets.jl

Page 23: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceOverview of AcausalNets.jlthe Julia language

More on the Julia language

Benefits

a unique, well-designedapproach to typing -dynamic, nominative,parametric

methods overridingmechanism

speed of the language,especially when it comes tonumeric computations

good documentation

Jupyter Notebook support

Drawbacks

the language has onlyrecently achieved maturity(July 2018)

third-party packages’developers don’t alwayskeep up with thedevelopment of thelanguage

relative unpopularity →small amount ofdevelopment tools

compiling slowsdevelopment down

Page 24: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceExperiments with Monty Hall game

Experiments with Monty Hall I

we use AcausalNets.jl to reproduce results of the research onquantum strategies in Monty Hall [Kurzyk and Glos, 2016]

we aim to find a quantum state AB in which the Player and theHost both have 50% chance of winning - a Nash equilibrium

for that purpose, we build appropriate Bayesian networks andanalyze the probabilities of |a〉 = |c〉 under various conditions

https://github.com/mikegpl/AcausalNets.jl/blob/master/notebooks/inferrer_monty_hall.ipynb

Page 25: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceExperiments with Monty Hall game

Experiments with Monty Hall IIWe consider the following quantum states of (A,B)

ρ̃AB = 13 (|00〉+ |11〉+ |22〉)(〈00|+ 〈11|+ 〈22|) (3)

ρ̂AB = 16 (|01〉+ |10〉)(〈01|+ 〈10|)

+ 16 (|02〉+ |20〉)(〈02|+ 〈20|) (4)

+ 16 (|12〉+ |21〉)(〈12|+ 〈21|)

ρ̃AB

always |a〉 = |b〉ρ̂AB

always |a〉 6= |b〉

Page 26: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceExperiments with Monty Hall game

Experiments with Monty Hall IIIWhat is the chance of Player winning if their choicesare entangled with prize placement?

λ ∈ [0, 1]we examinecombinationsλρ̃AB + (1− λ)ρ̂AB

we look for a λ forwhich there is a50% chance that|a〉 = |b〉we assume priorknowledge of|b〉, |c〉 and infer |a〉

Figure: Probability of |a〉 = |b〉 forvarious combinationsλρ̃AB + (1− λ)ρ̂AB

Page 27: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceSummary

Related work

original paper with Monty Hall experiments we reproduced: [Kurzykand Glos, 2016]

examples of quantum games and strategies beyond Monty Hall:[Szopa, 2013, Eisert et al., 1999]

classical Bayesian Networks and inference: [Huang and Darwiche,1996, Yedidia et al., 2003]

quantum Bayesian theory, generalization of inference: [Leifer andPoulin, 2008]

Julia programming language: [Bezanson et al., 2017],https://julialang.org/

Page 28: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceSummary

Summary

employing quantum strategies in games can yield results impossiblewith the classical ones

Bayesian networks are graphical probabilistic models which helpmodel related random variables

among other use cases, they are useful for modelingevents in gamesin order to analyze quantum games, we need ageneralization of Bayesian nets where acausalconnections between variables are possible

AcausalNets.jl is a Julia library which helps model Bayesiannetworks with acausal connections

using AcausalNets.jl, we perform experiments with a quantumversion of Monty Hall game

Page 29: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceSummary

Bibliography I

J. Bezanson, A. Edelman, S. Karpinski, and V. Shah. Julia: A freshapproach to numerical computing. SIAM Review, 59(1):65–98, 2017.doi: 10.1137/141000671. URLhttps://doi.org/10.1137/141000671.

Jens Eisert, Martin Wilkens, and Maciej Lewenstein. Quantum gamesand quantum strategies. Phys. Rev. Lett., 83:3077–3080, Oct 1999.doi: 10.1103/PhysRevLett.83.3077. URLhttps://link.aps.org/doi/10.1103/PhysRevLett.83.3077.

Cecil Huang and Adnan Darwiche. Inference in belief networks: Aprocedural guide. International Journal of Approximate Reasoning, 15(3):225 – 263, 1996. ISSN 0888-613X. doi:https://doi.org/10.1016/S0888-613X(96)00069-2. URLhttp://www.sciencedirect.com/science/article/pii/S0888613X96000692.

Page 30: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceSummary

Bibliography II

Dariusz Kurzyk and Adam Glos. Quantum inferring acausal structuresand the monty hall problem. Quantum Information Processing, 15(12):4927–4937, Dec 2016. ISSN 1573-1332. doi:10.1007/s11128-016-1431-8. URLhttps://doi.org/10.1007/s11128-016-1431-8.

Johan Kwisthout. Lecture notes : Computational complexity of bayesiannetworks. 2015.

M.S. Leifer and D. Poulin. Quantum graphical models and beliefpropagation. Annals of Physics, 323(8):1899 – 1946, 2008. ISSN0003-4916. doi: https://doi.org/10.1016/j.aop.2007.10.001. URLhttp://www.sciencedirect.com/science/article/pii/S0003491607001509.

Marek Szopa. Dlaczego w dylemat więźnia warto grać kwantowo? 012013.

Page 31: Quantum Bayesian Inference - informatyka.agh.edu.pl · QuantumBayesianInference Quantum Bayesian Inference MichałGrabowski MarcinPrzewięźlikowski InstituteofComputerScience,AGH,al

Quantum Bayesian InferenceSummary

Bibliography III

Jonathan S. Yedidia, William T. Freeman, and Yair Weiss. Exploringartificial intelligence in the new millennium. chapter UnderstandingBelief Propagation and Its Generalizations, pages 239–269. MorganKaufmann Publishers Inc., San Francisco, CA, USA, 2003. ISBN1-55860-811-7. URLhttp://dl.acm.org/citation.cfm?id=779343.779352.