From d9c00c5159e9d234b74d7601ede14c3cb57a2663 Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Thu, 29 Jan 2026 18:41:24 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20de=20commentaires=20et=20am=C3=A9l?= =?UTF-8?q?ioration=20de=20la=20fonction=20elbow=5Fwss=20pour=20une=20meil?= =?UTF-8?q?leure=20clart=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- M2/Clustering In Practice/compression_image.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/M2/Clustering In Practice/compression_image.R b/M2/Clustering In Practice/compression_image.R index 9e59947..ff8f9cb 100644 --- a/M2/Clustering In Practice/compression_image.R +++ b/M2/Clustering In Practice/compression_image.R @@ -88,7 +88,7 @@ cat("MSE =", mse_matrix, "\n") # Règle du coude (Elbow Method) -# tracez l'évolution de la Within-Cluster Sum of Squares (WCSS) en fonction de $k$ +# tracez l'évolution de la Within-Cluster Sum of Squares en fonction de $k$ # Prnde k = 2 à 32 # A partir de quel $k$ le gain visuel devient-il négligeable pour l'œil humain ? @@ -123,7 +123,7 @@ elbow_wss <- function(X, ks = 2:32, nstart = 10, scale_data = FALSE) { main = "Méthode du coude (k-means)" ) grid() - # invisible(data.frame(k = ks, WSS = wss)) + invisible(data.frame(k = ks, WSS = wss)) } # Exemple d'utilisation : @@ -165,7 +165,7 @@ elbow_wss_safe <- function(X, ks = 2:32, nstart = 20, scale_data = FALSE, seed = ) axis(1, at = ks) grid() - # invisible(data.frame(k = ks, WSS = wss)) + invisible(data.frame(k = ks, WSS = wss)) } # Exemple : @@ -182,6 +182,8 @@ jpeg("./data/image_compressed.jpg") plot(0, 0, type = "n", axes = FALSE, ann = FALSE) rasterImage(img_compressed, -1, -1, 1, 1) +dev.off() + info <- file.info("./data/PampasGrass.jpg") (taille_octets_reelle <- info$size / 1024)