Skip to content

Commit 199af5c

Browse files
authored
Merge pull request #78 from snowch/claude/fix-bernoulli-rendering-mjFhe
Add immutability comparison to frozen RV explanation
2 parents 2322892 + d7a2183 commit 199af5c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

chapter_07.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ print(f"Variance: {bernoulli_rv.var():.2f}")
228228

229229
When we write `bernoulli_rv = stats.bernoulli(p=p_positive)`, we're creating a **frozen random variable** — a distribution object with parameters locked in.
230230

231+
**Think of it like partial immutability:** Similar to how Python's immutable objects (strings, tuples) can't be changed after creation, a frozen RV's distribution parameters are fixed and can't be modified. The difference is that frozen RVs only "freeze" the parameters (like p=0.1), not the entire object.
232+
231233
**Two ways to use scipy.stats:**
232234

233235
1. **Non-frozen** (pass parameters every time):

0 commit comments

Comments
 (0)