Open yairdaon opened 5 months ago
In examples/inference/ex08-optimal_design.ipynb in the fifth code cell the following lines appear:
fltr1=np.kron([[0, 0, 0, 1]], np.identity(M)) obs1=np.einsum('ij,kj->ki', fltr1, x)
This is a very interesting way of writing obs1 = x[:,-2:]
Verify:
import numpy as np M = 2 x = np.random.randn(200, 4*M)
fltr1=np.kron([[0, 0, 0, 1]], np.identity(M)) np.all(np.einsum('ij,kj->ki', fltr1, x) == x[:,-2:])
In examples/inference/ex08-optimal_design.ipynb in the fifth code cell the following lines appear:
make a fltr to get Is for each age class
fltr1=np.kron([[0, 0, 0, 1]], np.identity(M)) obs1=np.einsum('ij,kj->ki', fltr1, x)
This is a very interesting way of writing obs1 = x[:,-2:]
Verify:
import numpy as np M = 2 x = np.random.randn(200, 4*M)
fltr1=np.kron([[0, 0, 0, 1]], np.identity(M)) np.all(np.einsum('ij,kj->ki', fltr1, x) == x[:,-2:])