繪製相對重要性熱度圖
做得很好!現在你要建立一個熱度圖,視覺化每個叢集的相對分數。
我們已將相對重要性分數載入為 relative_imp。seaborn 函式庫已載入為 sns,而來自 matplotlib 的 pyplot 模組可用作 plt。
本練習屬於課程
Python 的客群分群
練習說明
- 以 8 x 2 英吋的圖形尺寸初始化一個繪圖。
- 加上圖表標題。
- 使用
relative_imp資料繪製熱度圖。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Initialize a plot with a figure size of 8 by 2 inches
plt.____(____=(____, ____))
# Add the plot title
plt.____('Relative importance of attributes')
# Plot the heatmap
sns.____(data=____, annot=True, ____='.2f', ____='RdYlGn')
plt.show()