แสดงภาพ cluster ด้วย seaborn
มาแสดงภาพชุดข้อมูล footfall จาก Comic Con โดยใช้โมดูล seaborn กัน การแสดงภาพ cluster ด้วย seaborn ทำได้ง่ายขึ้นด้วยฟังก์ชัน hue ที่มีในตัวสำหรับ cluster labels
ข้อมูลถูกเก็บไว้ใน pandas DataFrame ชื่อ comic_con โดย x_scaled และ y_scaled คือชื่อคอลัมน์ของพิกัด X และ Y ที่ผ่านการ standardize แล้ว ณ ช่วงเวลาหนึ่ง cluster_labels เก็บ cluster labels และ linkage object ถูกเก็บไว้ในตัวแปร distance_matrix
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
การวิเคราะห์กลุ่มข้อมูลใน Python
คำแนะนำการฝึกหัด
- Import โมดูล seaborn ในชื่อ
sns - พล็อต scatter plot โดยใช้เมธอด
.scatterplot()ของseabornพร้อมกำหนด cluster labels เป็นอาร์กิวเมนต์hue
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Import the seaborn module
____
# Plot a scatter plot using seaborn
sns.scatterplot(x=____,
y=____,
____=____,
data = comic_con)
plt.show()