Skip to content

Commit d2c2fe3

Browse files
committed
Fix build errors: add missing mpl imports, fix indentation, update deprecated JAX API, fix undefined variable
- Add 'import matplotlib as mpl' to 7 files that use mpl.font_manager - Fix docstring indentation in ogm.py (7 spaces -> 8 spaces) - Update deprecated jax.lib.xla_bridge to jax.extend.backend in back_prop.md - Fix undefined variable '失败者列表' -> 'loser_list' in house_auction.md
1 parent d1e029e commit d2c2fe3

File tree

11 files changed

+13
-4
lines changed

11 files changed

+13
-4
lines changed

lectures/_static/lecture_specific/optgrowth_fast/ogm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self,
3434

3535

3636
def f(self, k):
37-
"生产函数"
37+
"生产函数"
3838
return k**self.α
3939

4040

lectures/back_prop.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,8 @@ Image(fig.to_image(format="png"))
533533
```{code-cell} ipython3
534534
## 检查环境中是否启用了gpu
535535
536-
from jax.lib import xla_bridge
537-
print(xla_bridge.get_backend().platform)
536+
import jax.extend
537+
print(jax.extend.backend.get_backend().platform)
538538
```
539539
540540
```{note}

lectures/bayes_nonconj.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ kernelspec:
4646
# install dependencies
4747
!pip install numpyro pyro-ppl torch jax
4848
```
49+
4950
```{code-cell} ipython3
5051
import numpy as np
5152
import seaborn as sns

lectures/house_auction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ def submit_bid(loser_list, p, ϵ, v, bid_info):
537537
```
538538

539539
```{code-cell} ipython3
540-
p,bid_info = submit_bid(失败者列表, p, ϵ, v, bid_info)
540+
p,bid_info = submit_bid(loser_list, p, ϵ, v, bid_info)
541541
```
542542

543543
```{code-cell} ipython3

lectures/imp_sample.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ kernelspec:
3333
import numpy as np
3434
from numba import jit, vectorize, prange
3535
import matplotlib.pyplot as plt
36+
import matplotlib as mpl
3637
FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf"
3738
mpl.font_manager.fontManager.addfont(FONTPATH)
3839
plt.rcParams['font.family'] = ['Source Han Serif SC']

lectures/likelihood_bayes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ kernelspec:
4747
```{code-cell} ipython3
4848
:hide-output: false
4949
50+
import matplotlib.pyplot as plt
51+
import matplotlib as mpl
5052
FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf"
5153
mpl.font_manager.fontManager.addfont(FONTPATH)
5254
plt.rcParams['font.family'] = ['Source Han Serif SC']

lectures/likelihood_ratio_process.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ kernelspec:
5252

5353
```{code-cell} ipython3
5454
import matplotlib.pyplot as plt
55+
import matplotlib as mpl
5556
FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf"
5657
mpl.font_manager.fontManager.addfont(FONTPATH)
5758
plt.rcParams['font.family'] = ['Source Han Serif SC']

lectures/likelihood_ratio_process_2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Blume和Easley构建了正式模型,研究关于风险收入过程概率的不
5555

5656
```{code-cell} ipython3
5757
import matplotlib.pyplot as plt
58+
import matplotlib as mpl
5859
FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf"
5960
mpl.font_manager.fontManager.addfont(FONTPATH)
6061
plt.rcParams['font.family'] = ['Source Han Serif SC']

lectures/likelihood_var.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ kernelspec:
4747
```{code-cell} ipython3
4848
import numpy as np
4949
import matplotlib.pyplot as plt
50+
import matplotlib as mpl
5051
FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf"
5152
mpl.font_manager.fontManager.addfont(FONTPATH)
5253
plt.rcParams['font.family'] = ['Source Han Serif SC']

lectures/mix_model.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ $$
116116
:hide-output: false
117117
118118
import matplotlib.pyplot as plt
119+
import matplotlib as mpl
119120
FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf"
120121
mpl.font_manager.fontManager.addfont(FONTPATH)
121122
plt.rcParams['font.family'] = ['Source Han Serif SC']

0 commit comments

Comments
 (0)