# What is the meaning of “probability distribution of p(x)” of something uncountable?

I'm studying VAE and new to both of the neural network and the statistic.

After some researches, I could understand the rough concept of VAE.
But what makes me confused is, the meaning of probability distribution p(x) itself.
When the x is an image data, what is the meaning of "probability distribution of the image"? and what is "probability distribution of the latent space"?

When I learned the probability distribution in school, x in p(x) was always something numerable(the value of dice, the number of apples, ..), and so I could get some value like p(x=1).
But I couldn't understand the meaning of p('image data'), p('latent space').
Although many websites explains the concept and logical flow of VAE magnificently, I'm stuck by the lack of my knowledge.

Anyone help me?

Let me preface this answer by saying I am not an expert on variational autoencoders, but I think your conceptual gaps don't have anything to do with autoencoders.

First, it is possible to specify a probability distribution over categorical outcomes or continuous outcomes. For example, a sample from a normal distribution is a continuous outcome, and the normal distribution describes the distribution of outcomes (or, equivalently, the relative likelihood of outcomes with various values). When you sample from a normal distribution, the probability of getting any particular numerical value (like 0, or 3.14) is infinitely small. Because of this, people typically talk about the probability density of a continuous distribution -- which can be interpreted as the likelihood of a sample being from a given (small) region. The probability value is called a probability density because it represents probability mass divided by space (or volume).

Second, it is common to represent images as a vector of numbers. For a grayscale image, this might be 1 numeric value per pixel (it's slightly more complicated for color images). You can think of the vector representation of an image as a point in space. If you have a bunch of images, you can talk about the density of images in this space. Some regions of space have a lot of 'image points', and some have very few. You can approximate this density by fitting a high-dimensional probability distribution to the image points in your dataset -- like fitting a smooth curve to a binned histogram of image counts. Because of this, each image maps to a specific value for the fitted probability density. That means you can talk about p(image) -- it really means, if we look 'near' the vector representation of this image in our vector space, how many images are there, relatively speaking? Some images are in high-density regions and some are in low-density regions, which will reflected as high and low values for p(image).

• Thank you for your answer. Then, if i have a bunch of 2x2 grayscale images, can I say p(x=[120,56,200,252]) means the probability that [120,56,200,252] represents an image in the bunch? – Newbee Oct 18 '19 at 19:08
• It's more like - the value returned by p(x=[120,56,200,252]) represents the density of images in the region near that image. Suppose p(x=[120,56,200,252]) = 0.2, but p(x=[0, 1, 2, 3]) = 0.1. Then that would indicate that the first image is in a denser region - there are more 'similar' images. Two caveats: 'nearby' images don't always look similar, and VAE's map images into a space where 'nearby' images look similar, which is cool. Second, as with draws from a Gaussian, the probability of a given image is technically zero - but you can talk about the prob of an image in the nearby region. – tom Oct 18 '19 at 20:08
• Thank you very much. Your answer made my understand more clear. It's shame that I can't express my understands from your reply and ask deeper questions due to my poor English writing skill. Have a nice day – Newbee Oct 18 '19 at 20:38

Well, images are numerable. Or at least their representation in the computer is. Images are arrays or numbers for the pixel values or tensors for RGB images. And they have a finite number of values making up the image. This allows you to consider them vectors (just flatten the arrays). So let's say you do this to get the vector x, which is your image. p(x) means nothing more than e.g. p(x_0 = 234 and x_1 = 132 and ...). Same thing with the latent representation z. The distributions are then basically what you know from school.

• Thank you for your answer. I know that image can be represented as a vector, but what I'm confusing is the value of p([115,250,120,...]). When p(x) denotes the probability of dice value, I can imagine p(x=1) = 1/6. But what is the meaning of p([pixel values])? – Newbee Oct 18 '19 at 18:54