We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 91ff5f1 commit 172a68dCopy full SHA for 172a68d
1 file changed
ngclearn/utils/analysis/effective_dim.py
@@ -0,0 +1,11 @@
1
+from jax import numpy as jnp
2
+
3
+def participation_ratio(Z):
4
+ Zc = Z - Z.mean(axis=0, keepdims=True)
5
+ cov = (Zc.T @ Zc) / (Zc.shape[0] - 1)
6
7
+ tr = jnp.trace(cov)
8
+ tr2_cov = tr * tr
9
+ cov2_tr = jnp.trace(cov @ cov)
10
11
+ return tr2_cov / cov2_tr if cov2_tr > 0 else float("nan")
0 commit comments