calculated covariance is in absolute units, so before storing in out_reg, need to scale it back to fractios
((1/R.T*I) * cov) * (1/R.T*I)
where R is the return values, I is an identity matrix and cov is the covariance.
This was expensive for some reason, lots of zeros? so instead use broadcasting:
cov = cov.T * 1/R # align last axes along observations, and scale in one direction
cov = np.swapaxes(cov, 0, 1) * 1/R # transpose each observations covariance and scale in other direction
cov = cov.T
Hopefully it works, needs more testing probably. :smile_cat:
calculated covariance is in absolute units, so before storing in out_reg, need to scale it back to fractios
where R is the return values, I is an identity matrix and cov is the covariance.
This was expensive for some reason, lots of zeros? so instead use broadcasting:
Hopefully it works, needs more testing probably. :smile_cat: