Skip to content

Commit

Permalink
Reduce redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
msluszniak committed Oct 18, 2023
1 parent 42a5b24 commit 0e08f6a
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/scholar/cluster/affinity_propagation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,6 @@ defmodule Scholar.Cluster.AffinityPropagation do
>
"""
defn predict(%__MODULE__{cluster_centers: cluster_centers} = _model, x) do
{num_clusters, num_features} = Nx.shape(cluster_centers)
{num_samples, _} = Nx.shape(x)
broadcast_shape = {num_samples, num_clusters, num_features}

dist = Scholar.Metrics.Distance.pairwise_euclidean(x, cluster_centers)

Nx.select(Nx.is_nan(dist), Nx.Constants.infinity(Nx.type(dist)), dist)
Expand Down

0 comments on commit 0e08f6a

Please sign in to comment.