여러 특성으로 클러스터링

Python으로 배우는 군집 분석

Shaumik Daityari

Business Analyst

기본 점검

# Cluster centers
print(fifa.groupby('cluster_labels')[['scaled_heading_accuracy', 
    'scaled_volleys', 'scaled_finishing']].mean())
cluster_labels scaled_heading_accuracy scaled_volleys scaled_finishing
0 3.21 2.83 2.76
1 0.71 0.64 0.58
# Cluster sizes
print(fifa.groupby('cluster_labels')['ID'].count())
cluster_labels count
0 886
1 114
Python으로 배우는 군집 분석

시각화

  • 클러스터 중심 시각화
  • 클러스터별 다른 변수 시각화

 

# Plot cluster centers
fifa.groupby('cluster_labels') \
  [scaled_features].mean()
  .plot(kind='bar')
plt.show()

Python으로 배우는 군집 분석

클러스터 상위 항목

# Get the name column of top 5 players in each cluster
for cluster in fifa['cluster_labels'].unique():
    print(cluster, fifa[fifa['cluster_labels'] == cluster]['name'].values[:5])
Cluster Label Top Players
0 ['Cristiano Ronaldo' 'L. Messi' 'Neymar' 'L. Suárez' 'R. Lewandowski']
1 ['M. Neuer' 'De Gea' 'G. Buffon' 'T. Courtois' 'H. Lloris']
Python으로 배우는 군집 분석

특성 축소

  • 요인분석
  • 다차원척도법
Python으로 배우는 군집 분석

최종 실습!

Python으로 배우는 군집 분석

Preparing Video For Download...