
from Scratch
355
from typing import List, Tuple
def most
_
popular
_
new
_
interests(
user
_
interests: List[str],
max
_
results: int = 5) -> List[Tuple[str, int]]:
suggestions = [(interest, frequency)
for interest, frequency in popular
_
interests.most
_
common()
if interest not in user
_
interests]
return suggestions[:max
_
results]
따라서 다음과 같은 관심사를 가진 사용자
1
은
["NoSQL", "MongoDB", "Cassandra", "HBase", "Postgres"]
다음과 같은 추천을 받게 된다.
[('Python', 4), ('R', 4), ('Java', 3), ('regression', 3), ('statistics', 3)]
반면 이미 대다수의 인기 항목에 관심을 가지고 있는 사용자
3
은 다음과 같은 추
천을 받는다.
[('Java', 3), ('HBase', 3), ('Big Data', 3),
('neural networks', 2), ('Hadoop', 2)]
물론 “많은 사람이 ...