Interview's MateData Science
Interview's Mate

Data Science

Python → ML → MLOps

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Science topics
Lesson 47/ 160
03. Mathematics & Statistics

Continuous Distributions (Normal, Exponential, Uniform)

Use continuous PDFs for measurement noise, waiting times, and uniform baselines.

IntermediateNormal · Exponential3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

A bell curve is for things that cluster around an average, the exponential is for how long you wait for something random, and the uniform is when every value in a range is equally likely.

Think of it like…

Normal: the heights of many people cluster around an average with symmetric spread. Exponential: the gaps between buses arriving at random. Uniform: spinning a perfectly balanced wheel where every position is equally likely.

Where you’ve seen it

Adult heights in a population are roughly normal with μ = 170 cm and σ = 8 cm. P(X > 186) = P(Z > 2) ≈ 0.0228, about 2.3% of people, and about 68% lie between 162 and 178 cm. Support calls arrive randomly at 0.5 per minute, so the wait for the next call is exponential with mean 2 minutes: P(wait > 3 min) = e⁻¹·⁵ ≈ 0.223 and the median wait is ln 2 / 0.5 ≈ 1.39 minutes. A random number uniform on [0, 10] has mean 5 and P(X < 2.5) = 0.25.

Words you’ll hear

PDF and CDF
Density (height of the curve; area = probability) and cumulative probability P(X ≤ x).
Normal(μ, σ)
Symmetric bell curve; 68–95–99.7 rule for ±1, 2, 3 σ.
Exponential(λ)
Waiting time between events at rate λ; mean 1/λ; memoryless.
Uniform(a, b)
Constant density between a and b.

Visual diagram

Loading interactive diagram

Theory & deep dive

Normal, exponential and uniform

Normal(μ, σ): symmetric, with mean = median = mode. About 68%, 95% and 99.7% of values lie within 1, 2 and 3 standard deviations. Standardising, z = (x − μ) / σ, maps any normal to the standard normal, so P(X > 186) with μ = 170, σ = 8 is P(Z > 2) = 0.0228. Sums and averages of many independent effects tend toward normal (the central limit theorem), and linear regression errors are often assumed normal. Exponential(λ): density λ e^(−λx) for x ≥ 0, survival P(X > x) = e^(−λx), mean 1/λ, standard deviation 1/λ, and the memoryless property P(X > s + t | X > s) = P(X > t). It's the waiting-time counterpart of the Poisson: if events per minute are Poisson(λ), the gaps are exponential(λ). Uniform(a, b): density 1/(b − a); mean (a + b)/2; variance (b − a)²/12.

Real data differ in predictable ways. Incomes and latencies are right-skewed and heavy-tailed (log-normal, Pareto), not normal; waiting times with a rising failure rate (wear-out) aren't memoryless, so Weibull is better; bounded ratios (rates between 0 and 1) suit Beta distributions. Fit and check rather than assume.

scipy.stats in practice

norm(170, 8).sf(186) ≈ 0.0228; expon(scale=2).sf(3) ≈ 0.223 (scale = 1/λ = 2 minutes); uniform(0, 10).cdf(2.5) = 0.25.

Key takeaway: Normal for symmetric noise, exponential for random waiting times, uniform for equal likelihood.

Checking fit and using them well

Compare data with a candidate distribution using a histogram overlaid with the fitted PDF, a Q-Q plot (scipy.stats.probplot or statsmodels.qqplot: points should follow the diagonal for normal data) and tests such as Shapiro-Wilk or Kolmogorov-Smirnov. With large samples tests reject trivial departures, so prefer plots and practical judgement; with small samples tests have little power. For skewed positive data try a log transform and check normality of the logs.

Uses: z-scores to flag unusual values, confidence intervals, simulation of arrivals (exponential gaps) and demand (normal or log-normal), random sampling (uniform draws underlie most generators), and priors (uniform as a non-informative starting point). Parameters are estimated from data (norm.fit, mean and std for normal; λ = 1/mean for exponential), but remember that estimates have uncertainty and that the fitted tail probabilities (P(X > 186)) are the most sensitive to a wrong distribution choice.

A Q-Q check

stats.probplot(df.height, dist="norm", plot=plt) plots ordered data against normal quantiles. A straight line supports normality; an S-curve means heavy tails, and a bend means skew.

Key takeaway: Check fit with plots first; tail probabilities depend most on the distribution assumption.

How it works, step by step

Step 1 of 4
Explore

1. Plot the variable

Draw a histogram and look for symmetry, skew, bounds and multiple modes.

hist + KDE
Key numbers at this step
Shape
first

When to use it & trade-offs

What it is

A continuous distribution describes a variable that can take any value in a range, with a probability density function (PDF); probabilities are areas under the curve, so the probability of any exact value is 0 and we ask about intervals. The normal (bell curve) is defined by mean μ and std σ and models measurement noise and sums of many small effects. The exponential with rate λ models waiting time between independent events (mean 1/λ, memoryless). The uniform on [a, b] gives equal density across an interval and models "no information" baselines and random number generation. The cumulative distribution function (CDF) gives P(X ≤ x).

Why it matters: These three appear constantly: z-scores and confidence intervals rest on the normal, time-to-event and queueing questions on the exponential, and simulation, random sampling and priors on the uniform. Knowing their shapes, parameters and quick probabilities lets you sanity-check data, simulate scenarios, and choose appropriate models (is waiting time really memoryless? are errors really symmetric?).

When to reach for it

  • z-scores and anomaly thresholds from normal data
  • Modelling time between arrivals or failures
  • Generating random inputs and non-informative priors

When to avoid or be careful

  • Assuming normality for incomes and latencies
  • Treating a density value as a probability
  • Relying on normality tests alone with very large samples

Continuous distributions

Normal
Best for: Symmetric measurements, averages, regression errors

Strengths: Well understood; basis for z-scores and CIs.

Watch out: Light tails; poor for skewed or heavy-tailed data.

Exponential
Best for: Waiting times between independent random events

Strengths: One parameter; memoryless; links to Poisson.

Watch out: Constant hazard assumption.

Uniform
Best for: Equal likelihood across a range; simulation

Strengths: Simple; basis for random generation.

Watch out: Rare in real measurements.

Interview signals & numbers to know

When this topic comes up

  • “Is this distribution normal?”
  • “Time between events”
  • “68-95-99.7 rule”
  • Q-Q plots
  • Memoryless property

Benchmarks & rules of thumb

68 / 95 / 99.7 -
percent within 1, 2, 3 σ of the mean
0.0228 -
P(Z > 2)
1/λ -
mean waiting time of an exponential

Common mistakes & follow-ups

Common interview mistakes

  • Using a normal model for order values and predicting negative amounts.
  • Entering the rate λ where scipy expects scale = 1/λ.
  • Concluding "not normal" from a significant Shapiro-Wilk test on 100,000 points with a near-perfect Q-Q plot.

Likely interviewer follow-ups

  • What does the memoryless property mean?
  • How do you check whether data are normally distributed?
  • How are the Poisson and exponential distributions related?
Interview tip: State the scipy parameterisation pitfall (scale = 1/λ). It's a small, concrete detail that shows you've used these distributions in code.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Continuous Distributions (Normal, Exponential, Uniform) with data science interview Q&A and hands-on practice.

Open Data Science Q&A →Machine Learning Q&A
Previous topic
Discrete Distributions (Binomial, Poisson)
Next topic
Central Limit Theorem (CLT)