始める無料で始める

モデルの性能を評価する

データセット全体を使ったモデルと、築年数カテゴリ別のモデルのどちらが優れているかを検証するために、いくつかの指標を計算してみましょう。ここでは、各モデルの決定係数と残差標準誤差を比較します。

価格とコンビニの数の関係を表す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: ", ____)
コードを編集して実行