import
from sklearn.preprocessing import MinMaxScaler
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score
MinMax Scaler
scaler = MinMaxScaler()
df_res_scaler = scaler.fit_transform(df_res)
Kmeans & silhouette_score
model = KMeans(n_clusters=k)
model.fit_transform(df_res_scaler)
model.labels_
sil = silhouette_score(df_res_scaler, model.labels_)
sil.round(2)
728x90
'Software Development > Data Science' 카테고리의 다른 글
Python kNN : KNeighborsRegressor 기초 동작 (0) | 2023.04.17 |
---|---|
명목형 변수의 One Hot Encoding + 합치기 (0) | 2023.04.16 |
수학문제-확률과 통계 (0) | 2023.04.15 |
로지스틱 회귀함수 (2) | 2023.04.14 |
Python RandomForestRegressor (0) | 2023.04.13 |