Skip to content
Snippets Groups Projects
Commit 418f7140 authored by MARMORET Axel's avatar MARMORET Axel
Browse files

Adding a small parameter to the divide in deep mu to avoid numerical instability.

parent 219efbe4
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,8 @@ def deep_KL_mu(W_Lm1, W_L, H_L, WH_Lp1, lambda_):
ONES = np.ones_like(W_Lm1)
a = ONES @ H_L.T - lambda_ * np.log(WH_Lp1)
b = W_L * ((W_Lm1 / (W_L @ H_L)) @ H_L.T)
W_L = np.maximum(eps, (1/lambda_ * b) / (lambertw(b * np.exp(a/lambda_) / lambda_, k=0).real))
lambert = lambertw(b * np.exp(a/lambda_) / lambda_, k=0).real
W_L = np.maximum(eps, (1/lambda_ * b) / (lambert + eps))
return W_L
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment