Skip to content

Commit 3c3ae7d

Browse files
committed
[mle] update units and labels
1 parent 8b68b04 commit 3c3ae7d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lectures/mle.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jupytext:
44
extension: .md
55
format_name: myst
66
format_version: 0.13
7-
jupytext_version: 1.14.5
7+
jupytext_version: 1.15.2
88
kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
@@ -102,8 +102,13 @@ Let's histogram this sample.
102102

103103
```{code-cell} ipython3
104104
fig, ax = plt.subplots()
105-
ax.set_xlim(-1,20)
106-
ax.hist(sample, density=True, bins=5_000, histtype='stepfilled', alpha=0.8)
105+
ax.set_xlim(-1, 20)
106+
density, edges = np.histogram(sample, bins=5000, density=True)
107+
prob = density * np.diff(edges)
108+
plt.stairs(prob, edges, fill=True, alpha=0.8, label=r"unit: $\$100,000$")
109+
plt.ylabel("prob")
110+
plt.xlabel("net wealth")
111+
plt.legend()
107112
plt.show()
108113
```
109114

@@ -502,7 +507,6 @@ ax.legend()
502507
plt.show()
503508
```
504509
505-
506510
Clearly, this distribution is not a good fit for our data.
507511
508512
```{solution-end}

0 commit comments

Comments
 (0)