开始使用免费开始使用

已观测歌曲的人气度

让我们用 Spotify 的 songs 数据练习预测歌曲的人气度。这样可以让您熟悉用于对未观测新数据进行预测的语法。

本练习是课程的一部分

使用 rstanarm 进行贝叶斯回归建模

查看课程

练习说明

  • 估计一个以 song_ageartist_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
___[___:___, ___:___]
编辑并运行代码