新しい楽曲の人気度
Beyoncé の最新アルバム Lemonade は、songs データセットには含まれていません。このアルバム収録曲の人気度を予測してみましょう。Lemonade はこのデータセットが作成される663日前にリリースされています。前の演習で作成した stan_model オブジェクトは、すでに環境に読み込まれています。
この演習はコースの一部です
rstanarm で学ぶベイズ回帰モデリング
演習の手順
- 予測用の新しいデータのデータフレームを作成し、
song_ageとartist_name変数を含めます - Lemonade の楽曲の予測人気度について、事後分布を作成します
- 事後分布からの最初の10ドローについて、予測人気度を出力します
- 新しい1件の観測に対する事後予測のサマリーを出力します
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Create data frame of new data
predict_data <- data.frame(___ = ___, ___ = "Beyoncé")
# Create posterior predictions for Lemonade album
new_predictions <- ___(stan_model, ___ = predict_data)
# Print first 10 predictions for the new data
___[___:___,]
# Print a summary of the posterior distribution of predicted popularity
___(new_predictions[, ___])