Computational Complexity of Inference

Similar documents
Inference as Optimization

Variable Elimination: Algorithm

Variable Elimination: Algorithm

NP Complete Problems. COMP 215 Lecture 20

From Bayesian Networks to Markov Networks. Sargur Srihari

Variable Elimination: Basic Ideas

NP Completeness and Approximation Algorithms

Conditional Independence

Inference in Graphical Models Variable Elimination and Message Passing Algorithm

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs

4 : Exact Inference: Variable Elimination

Essential facts about NP-completeness:

Likelihood Weighting and Importance Sampling

1. Introduction Recap

Probabilistic Reasoning. (Mostly using Bayesian Networks)

Inference in Bayesian Networks

MAP Examples. Sargur Srihari

Alternative Parameterizations of Markov Networks. Sargur Srihari

More Completeness, conp, FNP,etc. CS254 Chris Pollett Oct 30, 2006.

Structured Variational Inference

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

Probabilistic Partial Evaluation: Exploiting rule structure in probabilistic inference

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Alternative Parameterizations of Markov Networks. Sargur Srihari

Need for Sampling in Machine Learning. Sargur Srihari

Solution of Exercise Sheet 12

Comp487/587 - Boolean Formulas

Bayesian Networks: Representation, Variable Elimination

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

Computational Complexity of Bayesian Networks

last two digits of your SID

Introduction to Probabilistic Graphical Models

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

Sparse analysis Lecture II: Hardness results for sparse approximation problems

More on NP and Reductions

Limitations of Algorithm Power

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

CS21 Decidability and Tractability

Variable Elimination (VE) Barak Sternberg

NP-Completeness. Algorithmique Fall semester 2011/12

CS 350 Algorithms and Complexity

CSC384: Intro to Artificial Intelligence Reasoning under Uncertainty-II

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

Design and Analysis of Algorithms

Turing Machines and Time Complexity

CS 188: Artificial Intelligence. Bayes Nets

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition.

CSE 3500 Algorithms and Complexity Fall 2016 Lecture 25: November 29, 2016

Probabilistic Graphical Models and Bayesian Networks. Artificial Intelligence Bert Huang Virginia Tech

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

Lecture 20: conp and Friends, Oracles in Complexity Theory

Complexity, P and NP

Learning MN Parameters with Alternative Objective Functions. Sargur Srihari

1.1 P, NP, and NP-complete

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

Non-Deterministic Time

Propositional Logic: Evaluating the Formulas

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

NP and NP Completeness

On the Relationship between Sum-Product Networks and Bayesian Networks

BBM402-Lecture 11: The Class NP

COMPSCI 276 Fall 2007

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP

Intelligent Systems (AI-2)

CS 350 Algorithms and Complexity

CS151 Complexity Theory. Lecture 6 April 19, 2017

Introduction to Advanced Results

SAT, NP, NP-Completeness

Correctness of Dijkstra s algorithm

Lecture 19: Finish NP-Completeness, conp and Friends

Computational Complexity

On the Relationship between Sum-Product Networks and Bayesian Networks

Introduction Long transparent proofs The real PCP theorem. Real Number PCPs. Klaus Meer. Brandenburg University of Technology, Cottbus, Germany

More NP-Complete Problems

Machine Learning Lecture 14

NP-Complete Problems. Complexity Class P. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar..

Bayesian Networks and Markov Random Fields

Probabilistic Graphical Models: MRFs and CRFs. CSE628: Natural Language Processing Guest Lecturer: Veselin Stoyanov

Template-Based Representations. Sargur Srihari

Uncertainty and Bayesian Networks

LOGIC PROPOSITIONAL REASONING

Algorithms and Theory of Computation. Lecture 19: Class P and NP, Reduction

Deep Learning Srihari. Deep Belief Nets. Sargur N. Srihari

NP-Complete Reductions 1

NP Completeness and Approximation Algorithms

Probabilistic Graphical Models (I)

CS151 Complexity Theory. Lecture 13 May 15, 2017

Advanced topic: Space complexity

NP-Completeness. NP-Completeness 1

Hardness of Approximation

NP-Complete Problems. More reductions

Probabilistic Graphical Models

Spring Lecture 21 NP-Complete Problems

Computational Intractability 2010/4/15. Lecture 2

Bayesian Network Representation

There are two types of problems:

Transcription:

Computational Complexity of Inference Sargur srihari@cedar.buffalo.edu 1

Topics 1. What is Inference? 2. Complexity Classes 3. Exact Inference 1. Variable Elimination Sum-Product Algorithm 2. Factor Graphs 3. Exact Inference for Tree graphs 4. Exact inference in general graphs 2

Common BN Inference Problem PGMs represent joint probability distributions over a set of variables χ They are used to answer queries of interest The most common query type is a conditional probability query E: evidence variables, whose known value is e Y: query variables, whose distribution we wish to know Conditional probability query is P(Y E=e) 3

Computing conditional probability Assume: variables χ, evidence E=e, query Y Conditional probability query P(Y E=e) is: P(Y E = e) = P(Y,e) P(e) Evaluation of Numerator P(Y,e) If W=χ-Y-E, ie, variables not query or evidence P(y,e) = P(y,e,w) Evaluation of Denominator P(e) P(e) = w y P(y,e) From product rule This process corresponds to taking a vector of marginal probabilities P(y 1,e),..P(y k,e) and renormalizing the entries by P(e) to sum to 1 (1) Each term in summation over w is simply an entry in the distribution Rather than marginalizing over P(y,e,w) this allows reusing computation of (1)

Example Query with Cancer BN χ={a,ge,e,s,c,gd,se,l} Evidence variable is Se Serum Calcium is calcium in blood Query variable is C cancer We can evaluate P(C Se )as: P(C Se) = P(C,Se) P(Se) With W={A,Ge,E,S,Gd,L}: P(C,Se) = P(A,Ge,E,Sm,Se,C,L,G d) A,Ge,E,Sm,L,Gd = P(A)P(Ge)P(Gd)P(E A),P(Sm A,G)P(Se C)P(C E,Sm)P(L C,Gd) A,Ge,E,Sm,L,Gd P(Se) = P(C,Se ) C We take the marginal probabilities P(c 1,Se), P(c 2,Se) and renormalize the entries by P(Se) to sum to 1

Analysis of Complexity Approach of summing out the variables in the joint distribution is unsatisfactory P(y,e) = Returns us to exponential blow-up PGM was precisely designed to avoid this! We now show that problem of inference in PGMs is NP-hard Requires exponential time in the worst case except if P=NP P(y,e,w) Even worse, approximate inference is NP - hard Discussion for BNs applies to MNs also 6 w

What is a decision problem? Subset sum decision problem Given a set of integers, is there a subset that sums to zero? No polynomial time algorithm to decide this Given an instance, say set ω={ 2, 3, 15, 14, 7, 10} The guess { 2, 3, 10, 15} can be verified in poly time Definition of Decision Problem Π: L Π defines a precise set of instances L Π consists of integer sets which have a subset that sums to zero Decision problem Π: Is instance ω in L Π? Is ω a set of integers with a subset that sums to zero?

P and NP decision problems Probabilistic Graphical Models Definition of Decision Problem Π: L Π defines a precise set of instances Decision problem: Is instance ω in L Π? Decision problem Π is in P if there is an algorithm that decides in poly time NP if a guess can be verified in poly time Guess is produced non-deterministically Hence the name non-deterministic polynomial time Subset sum decision problem is in NP Whether a given subset sums to zero verified in poly time But not in P No poly algorithm to determine whether there exists any subset that sums to zero

3-SAT (Satisfiability) decision problem 3-SAT formula over binary variables q 1,.,,q n has the form C 1 C 2..C m C i is a clause of form l i,1 l i,2 l i,3 ; l i,j i =1,..,m; j =1,2,3 are literals which are either q k or ~q k e.g., with n=3 m=2 and clauses (q 1 ~q 2 ~q 3 ) (~q 1 q 2 ~q 3 ) there is a satisfying assignment (assigns true to formula): q 1 =q 2 =q 3 = true with clauses (~q 1 q 2 ) ( q 2 q 3 ) (~q 1 q 3 ) there is no satisfying assignment Each assignment verified in polynomial time Decision problem Π: Given a 3-SAT formula of size n, is there a satisfying assignment? To answer this we need to check n binary variables with 2 n assignments L Π is the set of 3-SAT formulas that have a satisfying assignment 9

What is P=NP? Input is a formula of size n A particular assignment γ can be verified in polynomial time, e.g., q 1 =q 2 =q 3 = true Suppose generate guess γ and verify if it satisfies Since guess verified in polynomial time, decision problem Π is in NP Deterministic problems are subset of nondeterministic ones. So P NP. Converse is biggest problem in complexity If you can verify in polynomial time, can you decide in polynomial time? Eg., is there a prime greater than n? 10

Probabilistic Graphical Models P=NP intuition Creating great art Complexity is NP Appreciating art: Complexity is P Is P=NP? Most mathematicians don t think so 11

NP-hard and NP-complete Hardest problems in NP are called NP-complete If poly time solution exists, can solve any in NP NP-hard problems need not have polynomial time verification If Π is NP-hard it can be transformed into Π in NP 3-SAT is NP-complete 12

BN for 3-SAT Propositional variables q 1,..,q n Return true if C 1 C 2..C m, where C i is a DNF of 3 binary variables q k, has a satisfying assignment, e.g., return true for 3-SAT formula (q 1 V ~q 2 V ~q 3 ) (~q 1 V q 2 ~q 3 ) since q 1 =q 2 =q 3 =true is a satisfying assignment and return false for (~q 1 q 2 ~q 3 ) ( q 2 q 3 ) (~q 1 q 3 ) which has no satisfying assignments BN to infer this: P(q k1 )=0.5 C i are deterministic OR A i are deterministic AND Q 1 C 1 Q 2 C 2 Q 3 C 3 Q 4... C m 1 C m Q n X is output (has value 1 iff all of the C i s are 1 A 1 A 2... A m 2 X 13

#P-complete Problem Counting the no. of satisfying assignments E.g., Propositional variables q 1,.,,q n Return true if C 1 C 2..C m, where C i is a DNF of 3 binary variables q k, has a satisfying assignment, 14

Analysis of Exact Inference Worst case: CPD is a table of size Val({X i } Pa Xi ) Most analyses of complexity are stated as decision-problems Consider decision problem first, then numerical one Natural version of conditional probability task is given next

Conditional Probability Decision Task Bayesian Network Probability - Decision task: BN-Pr-DP: Bayesian Network Decision Problem Given a BN B over χ, a variable X ε χ, and a value x εval(x) decide P B (X=x)>0 This decision problem can be shown to be NPcomplete as seen next

Proof of BN-Pr-DP is NP-complete Whether in NP : Guess assignment ξ to network variables. Check whether X=x and P(ξ)>0 One such guess succeeds iff P(X=x)>0. Done in linear time Is NP-hard: Answer for instances in BN-Pr-DP can be used to answer an NP-hard problem Show a reduction from 3-SAT problem 17

Reduction of 3-SAT to BN inference Given a 3-SAT formula φ create BN B φ with variable X such that φ is satisfiable iff P Bφ (X=x 1 )>0 If BN inference is solved in poly time we can also solve 3-SAT in poly time Q 1 Q 2 Q 3 Q 4 Q n BN to infer this: P(q k1 )=0.5 C i are deterministic OR A i are deterministic AND X is output C 1 A 1 C 2 A 2 C 3...... C m 1 A m 2 C m X 18

Original Inference Problem It is a numerical problem rather than a decision problem Define BN-Pr Given a BN B over χ, a variable X ε χ, and a value x εval(x) compute P B (X=x) Task is to compute the total probability of instantiations that are consistent with X=x Weighted count of instantiations, with weight being the probability This problem is #P-complete 19

Analysis of Approximate Inference Metrics for quality of approximation Absolute Error Estimate ρ has absolute error ε for P(y e) if P(y e)-ρ ε A weak definition of error. If a rare disease has probability 0.0001 then error of 0.0001 is unacceptable. If the probability is 0.3 then error of 0.0001 is fine Relative Error Estimate ρ has relative error ε for P(y e) if ρ/(1+ε) P(y e) ρ(1+ε) ε=4 means P(y e) is at least 20% of ρ and at most 600% of ρ. For low values much better than absolute error

Approximate Inference is NP-hard The following problem is NP-hard Given a BN B over χ, a variable X εχ and a value x ε Val(X), find a number ρ that has relative error ε for P B (X=x) Proof: It is NP-hard to decide if P B (x 1 ) >0 Assume algorithm returns estimate ρ to P B (x 1 ) which has relative error ε for some ε > 0 ρ>0 if and only if P B (x 1 )>0 This achieving relative error is NP-hard 21

Inference Algorithms Worst case is exponential Two types of inference algorithms Exact Variable Elimination Clique trees Approximate Optimization Propagation with approximate messages Variational (analytical approximations) Particle-based (sampling) 22