Skip to content

Commit

Permalink
Merge branch 'tsvd' of https://github.com/norm4nn/scholar into tsvd
Browse files Browse the repository at this point in the history
  • Loading branch information
norm4nn committed Oct 1, 2024
2 parents 6b57e1a + aa30ade commit 90856f5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/scholar/decomposition/pca.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 90856f5

Please sign in to comment.