開始使用免費開始

觀察到歌曲的熱門度

來練習用 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
___[___:___, ___:___]
編輯並執行程式碼