recommendation/user_reco.py
def users_to_recommend(self, nb_reco_user=5):
		"""
		compute the authors to recommend to the user based on link prediction and similarity
		:param nb_reco_user: number of users to recommend
		:return:
		"""
		ebunch = []
		authors = set(self.graph.nodes())
		authors.remove(self.user.id)
		for a in self.authors_liked:
			authors.remove(a)
		for author in authors:
			ebunch.append((self.user.id, author))

		preds = nx.jaccard_coefficient(self.graph, ebunch)
		reco_prio = []
		for u, a, p in preds:
			reco_prio.append({'author_name': a, 'prio': p})

		reco_prio = sorted(reco_prio, key=lambda k: k['prio'], reverse=True)[:nb_reco_user]
		reco_prio = self.rerank_authors(reco_prio)

		return [x['author_name'] for x in reco_prio]

		compute the authors to recommend to the user based on link prediction and similarity
		:param nb_reco_user: number of users to recommend
		:return:
		
compute the authors to recommend to the user based on link prediction and similarity
compute the authors to recommend to the user based on link prediction and similarity
def users_to_recommend(self, nb_reco_user=5):
		ebunch = []
		authors = set(self.graph.nodes())
		authors.remove(self.user.id)
		for a in self.authors_liked:
			authors.remove(a)
		for author in authors:
			ebunch.append((self.user.id, author))
		preds = nx.jaccard_coefficient(self.graph, ebunch)
		reco_prio = []
		for u, a, p in preds:
			reco_prio.append({'author_name': a, 'prio': p})
		reco_prio = sorted(reco_prio, key=lambda k: k['prio'], reverse=True)[:nb_reco_user]
		reco_prio = self.rerank_authors(reco_prio)
		return [x['author_name'] for x in reco_prio]
def users_to_recommend ( self , nb_reco_user = 5 ) : ebunch = [ ] authors = set ( self . graph . nodes ( ) ) authors . remove ( self . user . id ) for a in self . authors_liked : authors . remove ( a ) for author in authors : ebunch . append ( ( self . user . id , author ) ) preds = nx . jaccard_coefficient ( self . graph , ebunch ) reco_prio = [ ] for u , a , p in preds : reco_prio . append ( { 'author_name' : a , 'prio' : p } ) reco_prio = sorted ( reco_prio , key = lambda k : k [ 'prio' ] , reverse = True ) [ : nb_reco_user ] reco_prio = self . rerank_authors ( reco_prio ) return [ x [ 'author_name' ] for x in reco_prio ]
compute the authors to recommend to the user based on link prediction and similarity
compute the authors to recommend to the user based on link prediction and similarity
"""
		compute the authors to recommend to the user based on link prediction and similarity
		:param nb_reco_user: number of users to recommend
		:return:
		"""
None
self
nb_reco_user
number of users to recommend
number of users to recommend