配對次數統計
你現在已經能建立由相同使用者看過的電影所組成的所有排列組合的 DataFrame。不過,除非你能找出哪些電影最常被成對觀看,否則這還不太有用。
在本練習中,你會使用上一題中建立(並已為你載入)的 movie_combinations DataFrame,並產生一個新的 DataFrame,內容為各組電影配對出現的次數統計。
本練習屬於課程
用 Python 建立推薦引擎
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Calculate how often each item in movies_a occurs with the items in movies_b
combination_counts = movie_combinations.____(['movie_a', 'movie_b']).____()
# Inspect the results
print(combination_counts.head())