已观测歌曲的人气度
让我们用 Spotify 的 songs 数据练习预测歌曲的人气度。这样可以让您熟悉用于对未观测新数据进行预测的语法。
本练习是课程的一部分
使用 rstanarm 进行贝叶斯回归建模
练习说明
- 估计一个以
song_age和artist_name预测popularity的模型 - 打印该估计模型的摘要
- 为每首歌创建其预测得分的后验分布
- 打印前 5 首歌中每首歌的前 10 个预测得分
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Estimate the regression model
stan_model <- stan_glm(___, data = songs)
# Print the model summary
___(stan_model)
# Get posteriors of predicted scores for each observation
posteriors <- ___(stan_model)
# Print 10 predicted scores for 5 songs
___[___:___, ___:___]