開始使用免費開始

繪製相對重要性熱度圖

做得很好!現在你要建立一個熱度圖,視覺化每個叢集的相對分數。

我們已將相對重要性分數載入為 relative_impseaborn 函式庫已載入為 sns,而來自 matplotlibpyplot 模組可用作 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()
編輯並執行程式碼