JohnGoertz / Gumbi

Gaussian Process Model Building Interface
https://JohnGoertz.github.io/Gumbi/
Apache License 2.0
48 stars 1 forks source link

Implement "Law of total expectation/variance" in UPArrays #12

Open JohnGoertz opened 2 years ago

JohnGoertz commented 2 years ago

Given a list of UPArrays, y_upas, we can find total expectation/variance as:

μs = np.stack([y.μ for y in y_upas])
σ2s = np.stack([y.σ2 for y in y_upas])

total_upa = gmb.uparray('y',
                        μ = μs.mean(0),
                        σ2 = μs.var(0) + σ2s.mean(0),
                        stdzr=stdzr
                       )

Implement as something like

gmb.uparray.total(y_upas)

Where name and stdzr are inferred from, e.g., the first upa in the list.