From af925ffbc5480ee2a8d3218ec99e6cb0b83daccc Mon Sep 17 00:00:00 2001 From: Jackson Chin Date: Fri, 12 Jun 2026 10:19:32 -0700 Subject: [PATCH] Fixes sign bug in max-based normalization - Fixes bug in coupled factor normalization that could invert sign on some factors --- tensorpack/coupled.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorpack/coupled.py b/tensorpack/coupled.py index fab8342..52648c4 100644 --- a/tensorpack/coupled.py +++ b/tensorpack/coupled.py @@ -253,7 +253,7 @@ def normalize_factors(self, method="max"): for mmode in self.modes: sol = self.x["_" + mmode] if method == "max": # the one with maximum absolute value - norm_vec = np.array([max(sol[:, ii].min(), sol[:, ii].max(), key=abs) for ii in range(sol.shape[1])]) + norm_vec = abs(sol).max(axis=0).to_numpy() elif method == "norm": norm_vec = norm(sol, axis=0) else: