From e8f95387e70696c01b4b285cb2e361fc1d9b8b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=9Al=C4=99zak?= <128084860+jaksle@users.noreply.github.com> Date: Sun, 29 Oct 2023 02:57:59 +0200 Subject: [PATCH] Update clustering_quality.jl --- src/clustering_quality.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/clustering_quality.jl b/src/clustering_quality.jl index ca0dfdca..132fef10 100644 --- a/src/clustering_quality.jl +++ b/src/clustering_quality.jl @@ -218,17 +218,17 @@ function _cluquality_calinski_harabasz( ) n, k = size(data, 2), size(centers, 2) - w_idx1, w_idx2 = axes(weights) global_center = vec(mean(data, dims=2)) center_distances = colwise(metric, centers, global_center) - outer_intertia = sum( - weights[i,j₁]^fuzziness * center_distances[j₂] for i in w_idx1, (j₁,j₂) in zip(w_idx2, 1:k) - ) + outer_inertia = + sum(sum(w^fuzziness for w in w_col) * d + for (w_col, d) in zip(eachcol(weights), center_distances) + ) inner_inertia = _inner_inertia(data, centers, weights, fuzziness, metric) - return (outer_intertia / inner_inertia) * (n - k) / (k - 1) + return (outer_inertia / inner_inertia) * (n - k) / (k - 1) end # Davies-Bouldin index