L7: Probability Basics Outline Probability Probability Theory

Total Page:16

File Type:pdf, Size:1020Kb

L7: Probability Basics Outline Probability Probability Theory Outline 1. Bayes’ Law L7: Probability Basics 2. Probability distributions CS 344R/393R: Robotics Benjamin Kuipers 3. Decisions under uncertainty Probability Probability Theory • For a proposition A, the probability p(A) is • p(A,B) is the joint probability of A and B. your degree of belief in the truth of A. • p(A | B) is the conditional probability of A – By convention, 0 p(A) 1. ≤ ≤ given B. p(A | B) + p(¬A | B) =1 • This is the Bayesian view of probability. – It contrasts with the view that probability is the p(A,B) = p(B | A)" p(A) frequency that A is true, over some large population of experiments. • Bayes Law: p(A, B) p(A | B) " p(B) – The frequentist view makes it awkward to use p(B | A) = = data to estimate the value of a constant. ! p(A) p(A) Bayes’ Law for Diagnosis Which Hypothesis To Prefer? • Let H be a hypothesis, E be evidence. p(E | H) " p(H) • Maximum Likelihood (ML) p(H | E ) = p(E) – maxH p(E | H) • p(E | H) is the likelihood of the data, given – The model that makes the data most likely the hypothesis. • p(H) is prior probability of hypothesis. • Maximum a posteriori (MAP) – max p(E | H) p(H) • p(E) is prior probability of the evidence H (but acts as a normalizing constant). – The model that is the most probable explanation • p(H | E) is what you really want to know (posterior probability of hypothesis). • (Story: perfect match to rare disease) ! 1 ! ! Bayes Law Independence • The denominator in Bayes Law acts as a • Two random variables are independent if normalizing constant: – p(X,Y) = p(X) p(Y) – p(X | Y) = p(X) p(E | H) p(H) p(H | E) = = " p(E | H) p(H) – p(Y | X) = p(Y) p(E) – These are all equivalent. 1 " = p(E)#1 = • X and Y are conditionally independent given Z if $ p(E | H)p(H) – p(X,Y | Z) = p(X | Z) p(Y | Z) H – p(X | Y, Z) = p(X | Z) – p(Y | X, Z) = p(Y | Z) • It ensures that the probabilities sum to 1 • Independence simplifies inference. ! across all the hypotheses H. Accumulating Evidence (Naïve Bayes) Bayes Nets Represent Dependence p(d1 | H) p(d2 | H) p(dn | H) • The nodes are random variables. p(H | d1,d2 Ldn ) = p(H) L p(d1) p(d2 ) p(dn ) • The links represent dependence. n p(X i | parents(X i )) p(di | H) p(H | d1,d2 Ldn ) = p(H)* – Independence can be inferred from network " p(d ) ! i=1 i • The network represents how the joint n probability distribution can be decomposed. p(H | d1,d2 Ldn ) = " p(H)*# p(di | H) ! n i=1 p(X , X ) p(X | parents(X )) ! 1 L n = " i i n i=1 log p(H | d ,d d ) = log p(H) + log p(d | H) + $ # 1 2 L n " i • There are effective propagation algorithms. i=1 ! ! ! Simple Bayes Net Example Outline 1. Bayes’ Law 2. Probability distributions 3. Decisions under uncertainty 2 Expectations Variance and Covariance • Let x be a random variable. • The variance is E[ (x-E[x])2 ] • The expected value E[x] is the mean: N N 2 2 1 2 1 " = E[(x # x ) ] = $(xi # x ) E[x] = x p(x) dx # x = x N 1 " N $ i 1 • Covariance matrix is E[ (x-E[x])(x-E[x])T ] – The probability-weighted mean of all possible N values. The sample mean approaches it. 1 Cij = #(xik " x i )(x jk " x j ) • Expected value of a vector x is by component. N ! k=1 E[x] = x = [x , x ]T 1 L n – Divide by N−1 to make the sample variance an unbiased estimator for the population variance. Biased and Unbiased Estimators Covariance Matrix • Strictly speaking, the sample variance N 1 • Along the diagonal, Cii are variances. " 2 = E[(x # x ) 2] = (x # x ) 2 $ i • Off-diagonal C are essentially correlations. N 1 ij is a biased estimate of the population variance. An unbiased estimator is: # 2 & C1,1 = "1 C1,2 C1,N 1 N s2 = (x " x )2 % 2 ( # i C C = " N "1 1 % 2,1 2,2 2 ( • But: “If the difference between N and N−1 % O M ( ever matters to you, then you are probably % ( up to no good anyway …” [Press, et al] 2 ! $ CN,1 L CN,N = " N ' ! ! Independent Variation Dependent Variation ! ! • x and y are • c and d are random Gaussian random variables. variables (N=100) • Generated with • Generated with c=x+y d=x-y σx=1 σy=3 • Covariance matrix: • Covariance matrix: #10.62 "7.93& "0.90 0.44% Ccd = % ( Cxy = $ ' $" 7.93 8.84 ' #0.44 8.82& ! ! ! 3 Estimates and Uncertainty Gaussian (Normal) Distribution • Conditional probability density function • Completely described by N(µ,σ) – Mean µ – Standard deviation σ, variance σ 2 1 $( x$ µ )2 / 2" 2 " 2# e Illustrating the Central Limit Thm The Central Limit Theorem – Add 1, 2, 3, 4 variables from the same distribution. • The sum of many random variables – with the same mean, but – with arbitrary conditional density functions, converges to a Gaussian density function. • If a model omits many small unmodeled effects, then the resulting error should converge to a Gaussian density function. Detecting Modeling Error Outline • Every model is incomplete. – If the omitted factors are all small, the resulting errors should add up to a Gaussian. 1. Bayes’ Law ! • If the error between a model and the data 2. Probability distributions is not Gaussian, – Then some omitted factor is not small. 3. Decisions under uncertainty – One should find the dominant source of error and add it to the model. 4 Diagnostic Errors and Tests: Sensor Noise and Sensor Interpretation Decision Thresholds • Interpreting sensor values is like diagnosis. • Overlapping response Test=Pos Test=Neg to different cases: Disease True False No Yes present Positive Negative hit miss Disease False True false correct absent Positive Negative alarm reject • Every test has false positives and negatives. – Sonar(fwd)=d implies Obstacle-at-distance(d) ?? The Test ROC separation Threshold Curves d'= spread Requires a • The overlap Trade-Off d′ controls the trade-off ! • You can’t between eliminate all types of error. errors. • For more, search on • Choose which Signal Detection errors are Theory. important Bayesian Reasoning • One strength of Bayesian methods is that they reason with probability distributions, not just the most likely individual case. • For more, see Andrew Moore’s tutorial slides – http://www.autonlab.org/tutorials/ • Coming up: – Regression to find models from data – Kalman filters to track dynamical systems – Visual object trackers. 5.
Recommended publications
  • 2 Probability Theory and Classical Statistics
    2 Probability Theory and Classical Statistics Statistical inference rests on probability theory, and so an in-depth under- standing of the basics of probability theory is necessary for acquiring a con- ceptual foundation for mathematical statistics. First courses in statistics for social scientists, however, often divorce statistics and probability early with the emphasis placed on basic statistical modeling (e.g., linear regression) in the absence of a grounding of these models in probability theory and prob- ability distributions. Thus, in the first part of this chapter, I review some basic concepts and build statistical modeling from probability theory. In the second part of the chapter, I review the classical approach to statistics as it is commonly applied in social science research. 2.1 Rules of probability Defining “probability” is a difficult challenge, and there are several approaches for doing so. One approach to defining probability concerns itself with the frequency of events in a long, perhaps infinite, series of trials. From that per- spective, the reason that the probability of achieving a heads on a coin flip is 1/2 is that, in an infinite series of trials, we would see heads 50% of the time. This perspective grounds the classical approach to statistical theory and mod- eling. Another perspective on probability defines probability as a subjective representation of uncertainty about events. When we say that the probability of observing heads on a single coin flip is 1 /2, we are really making a series of assumptions, including that the coin is fair (i.e., heads and tails are in fact equally likely), and that in prior experience or learning we recognize that heads occurs 50% of the time.
    [Show full text]
  • Importance Sampling
    Chapter 6 Importance sampling 6.1 The basics To movtivate our discussion consider the following situation. We want to use Monte Carlo to compute µ = E[X]. There is an event E such that P (E) is small but X is small outside of E. When we run the usual Monte Carlo algorithm the vast majority of our samples of X will be outside E. But outside of E, X is close to zero. Only rarely will we get a sample in E where X is not small. Most of the time we think of our problem as trying to compute the mean of some random variable X. For importance sampling we need a little more structure. We assume that the random variable we want to compute the mean of is of the form f(X~ ) where X~ is a random vector. We will assume that the joint distribution of X~ is absolutely continous and let p(~x) be the density. (Everything we will do also works for the case where the random vector X~ is discrete.) So we focus on computing Ef(X~ )= f(~x)p(~x)dx (6.1) Z Sometimes people restrict the region of integration to some subset D of Rd. (Owen does this.) We can (and will) instead just take p(x) = 0 outside of D and take the region of integration to be Rd. The idea of importance sampling is to rewrite the mean as follows. Let q(x) be another probability density on Rd such that q(x) = 0 implies f(x)p(x) = 0.
    [Show full text]
  • Probability Distributions and Related Mathematical Constructs
    Appendix B More probability distributions and related mathematical constructs This chapter covers probability distributions and related mathematical constructs that are referenced elsewhere in the book but aren’t covered in detail. One of the best places for more detailed information about these and many other important probability distributions is Wikipedia. B.1 The gamma and beta functions The gamma function Γ(x), defined for x> 0, can be thought of as a generalization of the factorial x!. It is defined as ∞ x 1 u Γ(x)= u − e− du Z0 and is available as a function in most statistical software packages such as R. The behavior of the gamma function is simpler than its form may suggest: Γ(1) = 1, and if x > 1, Γ(x)=(x 1)Γ(x 1). This means that if x is a positive integer, then Γ(x)=(x 1)!. − − − The beta function B(α1,α2) is defined as a combination of gamma functions: Γ(α1)Γ(α2) B(α ,α ) def= 1 2 Γ(α1+ α2) The beta function comes up as a normalizing constant for beta distributions (Section 4.4.2). It’s often useful to recognize the following identity: 1 α1 1 α2 1 B(α ,α )= x − (1 x) − dx 1 2 − Z0 239 B.2 The Poisson distribution The Poisson distribution is a generalization of the binomial distribution in which the number of trials n grows arbitrarily large while the mean number of successes πn is held constant. It is traditional to write the mean number of successes as λ; the Poisson probability density function is λy P (y; λ)= eλ (y =0, 1,..
    [Show full text]
  • Lecture 17: Bivariate Normal Distribution F (X, Y) Is Given By
    Section 5.3 Bivariate Unit Normal Bivariate Unit Normal If X and Y have independent unit normal distributions then their joint Lecture 17: Bivariate Normal distribution f (x; y) is given by 2 − 1 (x2+y 2) f (x; y) = φ(x)φ(y) = c e 2 Sta230 / Mth230 Colin Rundel April 2, 2014 Sta230 / Mth230 (Colin Rundel) Lecture 17 April 2, 2014 1 / 20 Section 5.3 Bivariate Unit Normal Section 5.3 Bivariate Unit Normal Bivariate Unit Normal, cont. Bivariate Unit Normal - Normalizing Constant We can rewrite the joint distribution in terms of the distance r from the First, rewriting the joint distribution in this way also makes it possible to origin evaluate the constant of integration, c. From our previous discussions of the normal distribution we know that p 2 2 r = x + y c = p1 , but we never saw how to derive it explicitly. 2π 2 − 1 (x2+y 2) 2 − 1 r 2 f (x; y) = c e 2 = c e 2 This tells us something useful about this special case of the bivariate normal distributions: it is rotationally symmetric about the origin. r r + eps This particular fact is incredibly powerful and helps us solve a variety of Y problems. Sta230 / Mth230 (Colin Rundel) Lecture 17 April 2, 2014 2 / 20 Sta230 / Mth230 (Colin Rundel)X Lecture 17 April 2, 2014 3 / 20 Section 5.3 Bivariate Unit Normal Section 5.3 Bivariate Unit Normal Bivariate Unit Normal - Normalizing Constant Rayleigh Distribution The distance from the origin of a point (x; y) derived from X ; Y ∼ N (0; 1) is called the Rayleigh distribution.
    [Show full text]
  • Bridgesampling: an R Package for Estimating Normalizing Constants
    bridgesampling: An R Package for Estimating Normalizing Constants Quentin F. Gronau Henrik Singmann Eric-Jan Wagenmakers University of Amsterdam University of Zurich University of Amsterdam Abstract Statistical procedures such as Bayes factor model selection and Bayesian model averaging require the computation of normalizing constants (e.g., marginal likelihoods). These normalizing constants are notoriously difficult to obtain, as they usually involve high- dimensional integrals that cannot be solved analytically. Here we introduce an R package that uses bridge sampling (Meng and Wong 1996; Meng and Schilling 2002) to estimate normalizing constants in a generic and easy-to-use fashion. For models implemented in Stan, the estimation procedure is automatic. We illustrate the functionality of the package with three examples. Keywords: bridge sampling, marginal likelihood, model selection, Bayes factor, Warp-III. 1. Introduction In many statistical applications, it is essential to obtain normalizing constants of the form Z Z = q(θ) dθ; (1) Θ where p(θ) = q(θ)=Z denotes a probability density function (pdf) defined on the domain p Θ ⊆ R . For instance, the estimation of normalizing constants plays a crucial role in free energy estimation in physics, missing data analyses in likelihood-based approaches, Bayes factor model comparisons, and Bayesian model averaging (e.g., Gelman and Meng 1998). In this article, we focus on the role of the normalizing constant in Bayesian inference; however, the bridgesampling package can be used in any context where
    [Show full text]
  • Bayesian Inference
    Chapter 12 Bayesian Inference This chapter covers the following topics: Concepts and methods of Bayesian inference. • Bayesian hypothesis testing and model comparison. • Derivation of the Bayesian information criterion (BIC). • Simulation methods and Markov chain Monte Carlo (MCMC). • Bayesian computation via variational inference. • Some subtle issues related to Bayesian inference. • 12.1 What is Bayesian Inference? There are two main approaches to statistical machine learning: frequentist (or classical) methods and Bayesian methods. Most of the methods we have discussed so far are fre- quentist. It is important to understand both approaches. At the risk of oversimplifying, the difference is this: Frequentist versus Bayesian Methods In frequentist inference, probabilities are interpreted as long run frequencies. • The goal is to create procedures with long run frequency guarantees. In Bayesian inference, probabilities are interpreted as subjective degrees of be- • lief. The goal is to state and analyze your beliefs. 299 Statistical Machine Learning CHAPTER 12. BAYESIAN INFERENCE Some differences between the frequentist and Bayesian approaches are as follows: Frequentist Bayesian Probability is: limiting relative frequency degree of belief Parameter ✓ is a: fixed constant random variable Probability statements are about: procedures parameters Frequency guarantees? yes no To illustrate the difference, consider the following example. Suppose that X1,...,Xn N(✓, 1). We want to provide some sort of interval estimate C for ✓. ⇠ Frequentist Approach. Construct the confidence interval 1.96 1.96 C = X , X + . n − pn n pn Then P✓(✓ C)=0.95 for all ✓ R. 2 2 The probability statement is about the random interval C. The interval is random because it is a function of the data.
    [Show full text]
  • 9 Importance Sampling 3 9.1 Basic Importance Sampling
    Contents 9 Importance sampling 3 9.1 Basic importance sampling . 4 9.2 Self-normalized importance sampling . 8 9.3 Importance sampling diagnostics . 11 9.4 Example: PERT . 13 9.5 Importance sampling versus acceptance-rejection . 17 9.6 Exponential tilting . 18 9.7 Modes and Hessians . 19 9.8 General variables and stochastic processes . 21 9.9 Example: exit probabilities . 23 9.10 Control variates in importance sampling . 25 9.11 Mixture importance sampling . 27 9.12 Multiple importance sampling . 31 9.13 Positivisation . 33 9.14 What-if simulations . 35 End notes . 37 Exercises . 40 1 2 Contents © Art Owen 2009{2013,2018 do not distribute or post electronically without author's permission 9 Importance sampling In many applications we want to compute µ = E(f(X)) where f(x) is nearly zero outside a region A for which P(X 2 A) is small. The set A may have small volume, or it may be in the tail of the X distribution. A plain Monte Carlo sample from the distribution of X could fail to have even one point inside the region A. Problems of this type arise in high energy physics, Bayesian inference, rare event simulation for finance and insurance, and rendering in computer graphics among other areas. It is clear intuitively that we must get some samples from the interesting or important region. We do this by sampling from a distribution that over- weights the important region, hence the name importance sampling. Having oversampled the important region, we have to adjust our estimate somehow to account for having sampled from this other distribution.
    [Show full text]
  • Derivations of the Univariate and Multivariate Normal Density
    Derivations of the Univariate and Multivariate Normal Density Alex Francis & Noah Golmant Berkeley, California, United States Contents 1 The Univariate Normal Distribution 1 1.1 The Continuous Approximation of the Binomial Distribution . .1 1.2 The Central Limit Theorem . .4 1.3 The Noisy Process . .8 2 The Multivariate Normal Distribution 11 2.1 The Basic Case: Independent Univariate Normals . 11 2.2 Affine Transformations of a Random Vector . 11 2.3 PDF of a Transformed Random Vector . 12 2.4 The Multivariate Normal PDF . 12 1. The Univariate Normal Distribution It is first useful to visit the single variable case; that is, the well-known continuous proba- bility distribution that depends only on a single random variable X. The normal distribution formula is a function of the mean µ and variance σ2 of the random variable, and is shown below. ! 1 1 x − µ2 f(x) = p exp − σ 2π 2 σ This model is ubiquitous in applications ranging from Biology, Chemistry, Physics, Computer Science, and the Social Sciences. It's discovery is dated as early as 1738 (perhaps ironically, the name of the distribution is not attributed to it's founder; that is credited, instead, to Abraham de Moivre). But why is this model still so popular, and why has it seemed to gain relevance over time? Why do we use it as a paradigm for cat images and email data? The next section addresses three applications of the normal distribution, and in the process, derives it's formula using elementary techniques. 1.1. The Continuous Approximation of the Binomial Distribution Any introductory course in probability introduces counting arguments as a way to discuss probability; fundamentally, probability deals in subsets of larger supersets, so being able to count the cardinality of the subset and superset allows us to build a framework for think- ing about probability.
    [Show full text]
  • Exact Formulas for the Normalizing Constants of Wishart Distributions for Graphical Models
    EXACT FORMULAS FOR THE NORMALIZING CONSTANTS OF WISHART DISTRIBUTIONS FOR GRAPHICAL MODELS By Caroline Uhler∗, Alex Lenkoskiy, and Donald Richardsz Massachusetts Institute of Technology∗, Norwegian Computing Centery, and Penn State Universityz Gaussian graphical models have received considerable attention during the past four decades from the statistical and machine learning communities. In Bayesian treatments of this model, the G-Wishart distribution serves as the conjugate prior for inverse covariance ma- trices satisfying graphical constraints. While it is straightforward to posit the unnormalized densities, the normalizing constants of these distributions have been known only for graphs that are chordal, or decomposable. Up until now, it was unknown whether the normaliz- ing constant for a general graph could be represented explicitly, and a considerable body of computational literature emerged that at- tempted to avoid this apparent intractability. We close this question by providing an explicit representation of the G-Wishart normalizing constant for general graphs. 1. Introduction. Let G = (V; E) be an undirected graph with vertex p set V = f1; : : : ; pg and edge set E. Let S be the set of symmetric p × p p p matrices and S0 the cone of positive definite matrices in S . Let p p (1.1) S0(G) = fM = (Mij) 2 S0 j Mij = 0 for all (i; j) 2= Eg p denote the cone in S of positive definite matrices with zeros in all entries not corresponding to edges in the graph. Note that the positivity of all diagonal entries Mii follows from the positive-definiteness of the matrices M. p A random vector X 2 R is said to satisfy the Gaussian graphical model (GGM) with graph G if X has a multivariate normal distribution with mean −1 p µ and covariance matrix Σ, denoted X ∼ Np(µ, Σ), where Σ 2 S0(G).
    [Show full text]
  • Orthogonal Polynomials in Stein's Method
    Orthogonal Polynomials in Steins Metho d Wim Schoutens KatholiekeUniversiteit Leuven Department of Mathematics Celestijnenlaan B B Leuven Belgium Abstract We discuss Steins metho d for Pearsons and Ords family of distributions We giveasys tematic treatment including the Stein equation its solution and smo othness conditions Akey role in the analysis is played by the classical orthogonal p olynomials AMS Subject Classication J H Keywords Steins Method Orthogonal Polynomials Pearsons Class Ords Class Approximation Distributions Markov Processes Postdo ctoral Researcher of the Fund for Scientic Research Flanders Belgium Running Head Steins Method Orthogonal Polynomials Mailing Address Wim Schoutens Katholieke Universiteit Leuven Department of Math ematics Celestijnenlaan B B Leuven Belgium Email WimSchoutenswiskuleuvenacbe Intro duction Steins Metho d provides a way of nding approximations to the distribution say of a random variable which at the same time gives estimates of the approximation error involved The strenghts of the metho d are that it can b e applied in many circumstances in which dep endence plays a part In essence the metho d is based on a dening equation or equivalently an op erator of the distribution and a related Stein equation Up to now is was not clear which equation to take One could think at a lot of equations We show how for a broad class of distributions there is one equation who has a sp ecial role We give a systematic treatment including the Stein equation its solution and smo othness conditions A
    [Show full text]
  • Beta Distribution
    Beta Distribution Paul Johnson <[email protected]> and Matt Beverlin <[email protected]> June 10, 2013 1 Description How likely is it that the Communist Party will win the next elections in Russia? In my view, the probability is 0.33. You may think the chance is 0.22. Your brother thinks the chances are 0.6 and his sister-in-law thinks the chances are 0.1. People disagree and we would like a way to summarize the chances that a person will say 0.4 or 0.5 or whatnot. The Beta density function is a very versatile way to represent outcomes like proportions or probabilities. It is defined on the continuum between 0 and 1. There are two parameters which work together to determine if the distribution has a mode in the interior of the unit interval and whether it is symmetrical. The Beta can be used to describe not only the variety observed across people, but it can also describe your subjective degree of belief (in a Bayesian sense). If you are not entirely sure that the probability is 0.22, but rather you think that is the most likely value but that there is some chance that the value is higher or lower, then maybe your personal beliefs can be described as a Beta distribution. 2 Mathematical Definition The standard Beta distribution gives the probability density of a value x on the interval (0,1): xα−1(1 − x)β−1 Beta(α,β): prob(x|α,β) = (1) B(α,β) where B is the beta function Z 1 B(α,β) = tα−1(1 − t)β−1dt 0 2.1 Don’t let all of those betas confuse you.
    [Show full text]
  • The Continuous Bernoulli: Fixing a Pervasive Error in Variational
    The continuous Bernoulli: fixing a pervasive error in variational autoencoders Gabriel Loaiza-Ganem John P. Cunningham Department of Statistics Department of Statistics Columbia University Columbia University [email protected] [email protected] Abstract Variational autoencoders (VAE) have quickly become a central tool in machine learning, applicable to a broad range of data types and latent variable models. By far the most common first step, taken by seminal papers and by core software libraries alike, is to model MNIST data using a deep network parameterizing a Bernoulli likelihood. This practice contains what appears to be and what is often set aside as a minor inconvenience: the pixel data is [0; 1] valued, not f0; 1g as supported by the Bernoulli likelihood. Here we show that, far from being a triviality or nuisance that is convenient to ignore, this error has profound importance to VAE, both qualitative and quantitative. We introduce and fully characterize a new [0; 1]-supported, single parameter distribution: the continuous Bernoulli, which patches this pervasive bug in VAE. This distribution is not nitpicking; it produces meaningful performance improvements across a range of metrics and datasets, including sharper image samples, and suggests a broader class of performant VAE.1 1 Introduction Variational autoencoders (VAE) have become a central tool for probabilistic modeling of complex, high dimensional data, and have been applied across image generation [10], text generation [14], neuroscience [8], chemistry [9], and more. One critical choice in the design of any VAE is the choice of likelihood (decoder) distribution, which stipulates the stochastic relationship between latents and observables.
    [Show full text]