From 0a1dd766b67b22a4426367e5222f693e1531d5b0 Mon Sep 17 00:00:00 2001 From: jakubknczny Date: Fri, 25 Jun 2021 20:28:33 +0200 Subject: [PATCH] StandardScaler --- kMedoids.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kMedoids.py b/kMedoids.py index a6a422a..38227b3 100644 --- a/kMedoids.py +++ b/kMedoids.py @@ -5,7 +5,7 @@ import seaborn as sns from numpy.random import choice, seed from sklearn.decomposition import PCA -from sklearn.preprocessing import Normalizer +from sklearn.preprocessing import StandardScaler seed(42) @@ -44,7 +44,7 @@ def is_finished(old_medoids, new_medoids): def kmedoids(num_samples, num_clusters): df = pd.read_csv('CC GENERAL.csv', index_col='CUST_ID') df = df[:num_samples].fillna(0) - df_scaled = pd.DataFrame(Normalizer().fit_transform(df)) + df_scaled = pd.DataFrame(StandardScaler().fit_transform(df)) # initialize medoids (at random) medoids = initialize_medoids(num_medoids=num_clusters, data=df_scaled)