StandardScaler

This commit is contained in:
jakubknczny 2021-06-25 20:28:33 +02:00
parent de7b569a89
commit 0a1dd766b6

View File

@ -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)