3つの数値変数を可視化する
3D プロットには、もっと解釈しやすい「平面的な」代替案もあります。ただし、作成するには少し工夫が必要です。おすすめの方法は、2つの数値説明変数を散布図のx軸とy軸にプロットし、応答変数に応じて点に色を付けることです。
taiwan_real_estate を使用できます。
この演習はコースの一部です
statsmodels を使った中級 Regression
演習の手順
- 最寄りのMRT駅までの距離の平方根を
sqrt_dist_to_mrt_mとして計算します。 taiwan_real_estateデータセットを使って、sqrt_dist_to_mrt_mと近隣のコンビニ数の散布図を描き、住宅価格で色分けします。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Transform dist_to_mrt_m to sqrt_dist_to_mrt_m
taiwan_real_estate["sqrt_dist_to_mrt_m"] = ____
# Draw a scatter plot of sqrt_dist_to_mrt_m vs. n_convenience colored by price_twd_msq
____
# Show the plot
plt.show()