Skip to content

FIX: Deprecation and Future Warnings #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0645aa8
updates to perm_income_cons
mmcky Mar 12, 2025
3bca43b
check JAX deprecation fix
mmcky Mar 12, 2025
92a885d
Merge branch 'main' into fix-deprecation+future
mmcky Mar 31, 2025
c2e23e6
Merge branch 'main' into fix-deprecation+future
mmcky Mar 31, 2025
33ff39f
fix deprecation in jax
mmcky Mar 31, 2025
fef0379
Merge branch 'fix-deprecation+future' of https://github.com/QuantEcon…
mmcky Mar 31, 2025
a529e01
Merge branch 'main' into fix-deprecation+future
mmcky May 14, 2025
aaab768
fix linear_models
mmcky May 14, 2025
b40262a
Merge branch 'fix-deprecation+future' of https://github.com/QuantEcon…
mmcky May 14, 2025
7d5c7d1
fix kalman.md
mmcky May 14, 2025
81a44ff
remove testing variable
mmcky May 14, 2025
14b5359
kalman - remove debug
mmcky May 15, 2025
1775aa0
fix deprecations warnings in kalman_2
mmcky May 15, 2025
ffbe583
fix markov_perf deprecations
mmcky May 15, 2025
6158254
review kesten_processes and looking OK
mmcky May 15, 2025
9418da8
fix pandas_panel deprecations
mmcky May 15, 2025
2bb6e08
fix string formatting warning
mmcky May 15, 2025
383dfef
fix missing solution-end makers
mmcky May 15, 2025
3a1aba2
fix missing solution end
mmcky May 15, 2025
b62d770
ensure latex is installed for rendering of plot (collab)
mmcky May 19, 2025
6b1d639
Revert "ensure latex is installed for rendering of plot (collab)"
mmcky May 19, 2025
5fb9403
move texlive install for collab to action
mmcky May 19, 2025
d73fa6c
check pickled environment failure
mmcky May 19, 2025
6343390
[linear_models] final deprecation notice
mmcky May 19, 2025
5f66dd9
remove debug
mmcky May 19, 2025
1d84fc5
add gpu backend code to the top of the lecture
mmcky May 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lectures/back_prop.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ jupytext:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.11.5
jupytext_version: 1.16.7
kernelspec:
display_name: Python 3
display_name: Python 3 (ipykernel)
language: python
name: python3
---
Expand Down Expand Up @@ -606,9 +606,7 @@ Image(fig.to_image(format="png"))

```{code-cell} ipython3
## to check that gpu is activated in environment

from jax.lib import xla_bridge
print(xla_bridge.get_backend().platform)
print(f"JAX backend: {jax.devices()[0].platform}")
```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mmcky,

This note is at the end of the lecture. Should we move it with the note below to the top?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @HumphreyYang I will add that change and then merge.

Appreciate you taking a look.

```{note}
Expand Down
52 changes: 26 additions & 26 deletions lectures/perm_income_cons.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ jupytext:
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.16.7
kernelspec:
display_name: Python 3
display_name: Python 3 (ipykernel)
language: python
name: python3
---
Expand All @@ -29,10 +31,9 @@ kernelspec:

In addition to what's in Anaconda, this lecture will need the following libraries:

```{code-cell} ipython
---
tags: [hide-output]
---
```{code-cell} ipython3
:tags: [hide-output]

!pip install quantecon
```

Expand Down Expand Up @@ -74,9 +75,8 @@ The model will prove useful for illustrating concepts such as

Let's start with some imports:

```{code-cell} ipython
```{code-cell} ipython3
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (11, 5) #set default figure size
import quantecon as qe
import numpy as np
import scipy.linalg as la
Expand Down Expand Up @@ -329,7 +329,7 @@ In what follows we set it equal to unity.

First, we create the objects for the optimal linear regulator

```{code-cell} python3
```{code-cell} ipython3
# Set parameters
α, β, ρ1, ρ2, σ = 10.0, 0.95, 0.9, 0.0, 1.0

Expand Down Expand Up @@ -364,7 +364,7 @@ sxbewley = sxo

The next step is to create the matrices for the LQ system

```{code-cell} python3
```{code-cell} ipython3
A12 = np.zeros((3,1))
ALQ_l = np.hstack([A, A12])
ALQ_r = np.array([[0, -R, 0, R]])
Expand All @@ -383,7 +383,7 @@ CLQ = np.array([0., σ, 0., 0.]).reshape(4,1)

Let's print these out and have a look at them

```{code-cell} python3
```{code-cell} ipython3
print(f"A = \n {ALQ}")
print(f"B = \n {BLQ}")
print(f"R = \n {RLQ}")
Expand All @@ -392,14 +392,14 @@ print(f"Q = \n {QLQ}")

Now create the appropriate instance of an LQ model

```{code-cell} python3
```{code-cell} ipython3
lqpi = qe.LQ(QLQ, RLQ, ALQ, BLQ, C=CLQ, beta=β_LQ)
```

We'll save the implied optimal policy function soon compare them with what we get by
employing an alternative solution method

```{code-cell} python3
```{code-cell} ipython3
P, F, d = lqpi.stationary_values() # Compute value function and decision rule
ABF = ALQ - BLQ @ F # Form closed loop system
```
Expand Down Expand Up @@ -428,7 +428,7 @@ $$

Now we'll apply the formulas in this system

```{code-cell} python3
```{code-cell} ipython3
# Use the above formulas to create the optimal policies for b_{t+1} and c_t
b_pol = G @ la.inv(np.eye(3, 3) - β * A) @ (A - np.eye(3, 3))
c_pol = (1 - β) * G @ la.inv(np.eye(3, 3) - β * A)
Expand All @@ -453,13 +453,13 @@ G_LSS = np.hstack([G_LSS1, G_LSS2])

`A_LSS` calculated as we have here should equal `ABF` calculated above using the LQ model

```{code-cell} python3
```{code-cell} ipython3
ABF - A_LSS
```

Now compare pertinent elements of `c_pol` and `F`

```{code-cell} python3
```{code-cell} ipython3
print(c_pol, "\n", -F)
```

Expand Down Expand Up @@ -501,7 +501,7 @@ A second graph plots a collection of simulations against the population distrib

Comparing sample paths with population distributions at each date $t$ is a useful exercise---see {ref}`our discussion <lln_mr>` of the laws of large numbers

```{code-cell} python3
```{code-cell} ipython3
lss = qe.LinearStateSpace(A_LSS, C_LSS, G_LSS, mu_0=μ_0, Sigma_0=Σ_0)
```

Expand All @@ -514,7 +514,7 @@ In the code below, we use the [LinearStateSpace](https://github.com/QuantEcon/Qu
- simulate a group of 25 consumers and plot sample paths on the same
graph as the population distribution.

```{code-cell} python3
```{code-cell} ipython3
def income_consumption_debt_series(A, C, G, μ_0, Σ_0, T=150, npaths=25):
"""
This function takes initial conditions (μ_0, Σ_0) and uses the
Expand Down Expand Up @@ -545,8 +545,8 @@ def income_consumption_debt_series(A, C, G, μ_0, Σ_0, T=150, npaths=25):
debt_var = np.empty(T)
for t in range(T):
μ_x, μ_y, Σ_x, Σ_y = next(moment_generator)
cons_mean[t], cons_var[t] = μ_y[1], Σ_y[1, 1]
debt_mean[t], debt_var[t] = μ_x[3], Σ_x[3, 3]
cons_mean[t], cons_var[t] = μ_y[1,0], Σ_y[1, 1]
debt_mean[t], debt_var[t] = μ_x[3,0], Σ_x[3, 3]

return bsim, csim, ysim, cons_mean, cons_var, debt_mean, debt_var

Expand Down Expand Up @@ -622,7 +622,7 @@ def consumption_debt_fanchart(csim, cons_mean, cons_var,

Now let's create figures with initial conditions of zero for $y_0$ and $b_0$

```{code-cell} python3
```{code-cell} ipython3
out = income_consumption_debt_series(A_LSS, C_LSS, G_LSS, μ_0, Σ_0)
bsim0, csim0, ysim0 = out[:3]
cons_mean0, cons_var0, debt_mean0, debt_var0 = out[3:]
Expand All @@ -632,7 +632,7 @@ consumption_income_debt_figure(bsim0, csim0, ysim0)
plt.show()
```

```{code-cell} python3
```{code-cell} ipython3
consumption_debt_fanchart(csim0, cons_mean0, cons_var0,
bsim0, debt_mean0, debt_var0)

Expand Down Expand Up @@ -698,7 +698,7 @@ behavior early in the sample.

By altering initial conditions, we shall remove this transient in our second example to be presented below

```{code-cell} python3
```{code-cell} ipython3
def cointegration_figure(bsim, csim):
"""
Plots the cointegration
Expand All @@ -713,7 +713,7 @@ def cointegration_figure(bsim, csim):
return fig
```

```{code-cell} python3
```{code-cell} ipython3
cointegration_figure(bsim0, csim0)
plt.show()
```
Expand Down Expand Up @@ -756,7 +756,7 @@ There is no need for foreigners to lend to our group.

Let's have a look at the corresponding figures

```{code-cell} python3
```{code-cell} ipython3
out = income_consumption_debt_series(A_LSS, C_LSS, G_LSS, mxbewley, sxbewley)
bsimb, csimb, ysimb = out[:3]
cons_meanb, cons_varb, debt_meanb, debt_varb = out[3:]
Expand All @@ -766,7 +766,7 @@ consumption_income_debt_figure(bsimb, csimb, ysimb)
plt.show()
```

```{code-cell} python3
```{code-cell} ipython3
consumption_debt_fanchart(csimb, cons_meanb, cons_varb,
bsimb, debt_meanb, debt_varb)

Expand All @@ -785,7 +785,7 @@ But now there is some initial dispersion because there is *ex-ante* heterogeneit

Let's have a look at the cointegration figure

```{code-cell} python3
```{code-cell} ipython3
cointegration_figure(bsimb, csimb)
plt.show()
```
10 changes: 9 additions & 1 deletion lectures/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ and the following package versions
!conda list
```

This lecture series also has access to the following GPU
You can check the backend used by JAX using:

```{code-cell} ipython3
import jax
# Check if JAX is using GPU
print(f"JAX backend: {jax.devices()[0].platform}")
```

and this lecture series also has access to the following GPU

```{code-cell} ipython
!nvidia-smi
Expand Down
Loading