Following our discussion on Probability Density Functions (PDFs) for continuous variables, let's look at one of the most straightforward continuous distributions: the Uniform distribution.
Imagine a random process where any value within a specific range is just as likely to occur as any other value in that range. Think of a perfect random number generator that produces numbers between 0 and 1; any number in that interval has an equal chance of being generated. This scenario is modeled by the Continuous Uniform distribution.
A continuous random variable X follows a Uniform distribution if it takes values within a defined interval, say from a to b, and the probability density is constant throughout this interval. Outside this interval, the probability density is zero.
The distribution is characterized by two parameters:
The PDF for a Uniform distribution, denoted as U(a,b), defines this constant probability density within the interval [a,b]. Since the total area under any PDF curve must equal 1 (representing 100% probability), and the width of the interval is b−a, the height of the PDF must be b−a1.
The formula for the PDF is:
f(x;a,b)={b−a10for a≤x≤botherwiseThis formula tells us that if a value x falls within the range [a,b], the probability density is a constant positive value. If x is outside this range, the probability density is zero, meaning such values cannot occur. The graph of the PDF looks like a simple rectangle.
The Probability Density Function (PDF) for a Uniform distribution defined on the interval [2,8]. The density is constant at 1/(8−2)=1/6 within this interval and zero elsewhere. The total area under the curve is (8−2)×(1/6)=1.
For continuous distributions, probabilities correspond to areas under the PDF curve. For the uniform distribution, calculating the probability that X falls within a sub-interval [c,d] (where a≤c≤d≤b) is straightforward. It's simply the area of the rectangle with width d−c and height b−a1.
P(c≤X≤d)=Width×Height=(d−c)×b−a1=b−ad−cFor example, using our U(2,8) distribution:
Mean (Expected Value): The average value you'd expect is the midpoint of the interval:
μ=E[X]=2a+bFor U(2,8), the mean is 22+8=5.
Variance: The variance measures the spread of the distribution:
σ2=Var(X)=12(b−a)2The variance depends only on the width of the interval (b−a). A wider interval means greater variance. For U(2,8), the variance is 12(8−2)2=1262=1236=3. The standard deviation is σ=3≈1.732.
The Uniform distribution is often used when we have minimal information about a process, other than that the values are restricted to a certain range, and we have no reason to believe any value within that range is more likely than another.
While perhaps less common in direct machine learning model outputs compared to distributions like the Normal distribution, understanding the Uniform distribution is important for grasping the fundamentals of continuous probability and its role in simulation and uncertainty representation. Later, we'll see how to generate samples from this and other distributions using Python.
© 2025 ApX Machine Learning