Skip to content
Learn Netverks

Lesson

Step 7/36 19% through track

distributions-preview

Distributions preview

Last reviewed May 28, 2026 Content v20260528
Track mode
server_script
Means
Server runner
Reading
~1 min
Level
beginner

This lesson

This lesson teaches Distributions preview: SciPy scientific routines on NumPy arrays—statistics, optimization, linear algebra, and numerical methods.

Teams apply Distributions preview in every serious SciPy project—skipping it leaves blind spots in analysis and reviews.

You will apply Distributions preview in contexts like: Research code, engineering simulations, and specialized analytics.

Read the narrative, run NumPy + SciPy snippets in the playground (install scipy and numpy with pip if needed), inspect outputs and convergence, and complete MCQs.

When you can explain the previous lesson's ideas in your own words.

SciPy names distributions consistently: stats.norm, stats.t, stats.chi2, stats.binom, etc. Each supports pdf/cdf/ppf and random sampling for simulation and inference.

Common distributions

  • norm — Gaussian (continuous)
  • t — Student's t (small-sample inference)
  • chi2 — chi-squared (goodness of fit, variance tests)
  • binom, poisson — discrete counts
  • uniform, expon — modeling and simulation

Fitting and comparing

Use stats.fit (newer API) or manual MLE with curve_fit for custom models. Compare empirical histograms to theoretical pdf for sanity checks.

Examples

import numpy as np
from scipy import stats

print('binom P(X=3):', stats.binom.pmf(3, n=10, p=0.3))
print('t 95% critical (df=9):', stats.t.ppf(0.975, df=9))

Important interview questions and answers

  1. Q: pdf vs pmf?
    A: pdf for continuous density; pmf for discrete probability mass at integer k.
  2. Q: loc and scale?
    A: Location and scale parameters—mean and std for normal; generalize to other families.

Self-check

  1. Give pdf vs pmf use cases.
  2. What does ppf return for norm?

Pitfall: Use pmf for discrete counts (binom) and pdf for continuous (norm)—mixing them is a common exam mistake.

Interview prep

pdf vs pmf?

pdf for continuous density; pmf for discrete probability at integer k.

ppf?

Inverse CDF—quantile for given probability mass.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • PDF vs CDF?
  • fit caveats?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump