モデルの性能を評価する
データセット全体を使ったモデルと、築年数カテゴリ別のモデルのどちらが優れているかを検証するために、いくつかの指標を計算してみましょう。ここでは、各モデルの決定係数と残差標準誤差を比較します。
価格とコンビニの数の関係を表す4つのモデル(mdl_all_ages、mdl_0_to_15、mdl_15_to_30、mdl_30_to_45)が用意されています。
この演習はコースの一部です
statsmodels を使った中級 Regression
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Print the coeff. of determination for mdl_all_ages
print("R-squared for mdl_all_ages: ", ____)
# Print the coeff. of determination for mdl_0_to_15
print("R-squared for mdl_0_to_15: ", ____)
# Print the coeff. of determination for mdl_15_to_30
print("R-squared for mdl_15_to_30: ", ____)
# Print the coeff. of determination for mdl_30_to_45
print("R-squared for mdl_30_to_45: ", ____)