Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
msluszniak committed Oct 19, 2023
1 parent 9b74d9a commit 22c997c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/scholar/cluster/affinity_propagation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,16 @@ defmodule Scholar.Cluster.AffinityPropagation do
e = Nx.put_slice(e, [0, Nx.remainder(i, converge_after)], curr_e_slice)
k = Nx.sum(curr_e, axes: [0])

stop = if i >= converge_after do
se = Nx.sum(e, axes: [1])
unconverged = Nx.sum((se == 0) + (se == converge_after)) != num_samples
if (not unconverged and k > 0) or i == iterations do
Nx.u8(1)
else
stop
stop =
if i >= converge_after do
se = Nx.sum(e, axes: [1])
unconverged = Nx.sum((se == 0) + (se == converge_after)) != num_samples

if (not unconverged and k > 0) or i == iterations do
Nx.u8(1)
else
stop
end
end
end

Expand Down

0 comments on commit 22c997c

Please sign in to comment.