モデルの当てはめ
ある大学から、勉強時間と特定のテストでの得点との関係を示すデータが提供されました。
データは hours_of_study と scores という変数から利用できます。線形モデルを使ってデータから学習してください。
この演習はコースの一部です
Pythonで学ぶ確率の基礎
演習の手順
scipy.statsからlinregress()関数をインポートします。hours_of_studyとscoresの変数にあるデータを使って線形モデルを学習します。- パラメータを出力します。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Import the linregress() function
from scipy.stats import ____
# Get the model parameters
slope, intercept, r_value, p_value, std_err = ____(____, ____)
# Print the linear model parameters
print('slope:', ____)
print('intercept:', ____)