From aa30adef9afe84525deba44d29abcbedd1a98981 Mon Sep 17 00:00:00 2001 From: Szymon Date: Mon, 30 Sep 2024 18:43:37 +0200 Subject: [PATCH] Update lib/scholar/decomposition/pca.ex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Valim --- lib/scholar/decomposition/pca.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/scholar/decomposition/pca.ex b/lib/scholar/decomposition/pca.ex index 99347f59..f7a5d699 100644 --- a/lib/scholar/decomposition/pca.ex +++ b/lib/scholar/decomposition/pca.ex @@ -471,6 +471,7 @@ defmodule Scholar.Decomposition.PCA do end end + @doc false defn flip_svd(u, v) do max_abs_cols_idx = u |> Nx.abs() |> Nx.argmax(axis: 0, keep_axis: true) signs = u |> Nx.take_along_axis(max_abs_cols_idx, axis: 0) |> Nx.sign() |> Nx.squeeze()