recommendation/user_reco.py
def rerank_authors(self, authors_prio):
		"""
		rerank results from authors_prio based on their similarity with the user
		:param authors_prio: the jaccard coefficient for the link prediction between the user and each kept author
		:return:
		"""
		reranked_reco = []
		for a, p in authors_prio:
			author = DB.get_instance().query(Author).filter(Author.name == a).first()
			author_vec = ProfileOneHotEncoder.add_info_to_vec(author.vector, author.gender, author.localisation,
			                                                  author.emotion).reshape(1, -1)
			sim = cosine_similarity(self.user_vec, author_vec)
			reranked_reco.append({'author_name': a, 'sim': sim[0]})
		return sorted(reranked_reco, key=lambda k: k['sim'], reverse=True)

		rerank results from authors_prio based on their similarity with the user
		:param authors_prio: the jaccard coefficient for the link prediction between the user and each kept author
		:return:
		
rerank results from authors_prio based on their similarity with the user
rerank results from authors_prio based on their similarity with the user
def rerank_authors(self, authors_prio):
		reranked_reco = []
		for a, p in authors_prio:
			author = DB.get_instance().query(Author).filter(Author.name == a).first()
			author_vec = ProfileOneHotEncoder.add_info_to_vec(author.vector, author.gender, author.localisation,
			                                                  author.emotion).reshape(1, -1)
			sim = cosine_similarity(self.user_vec, author_vec)
			reranked_reco.append({'author_name': a, 'sim': sim[0]})
		return sorted(reranked_reco, key=lambda k: k['sim'], reverse=True)
def rerank_authors ( self , authors_prio ) : reranked_reco = [ ] for a , p in authors_prio : author = DB . get_instance ( ) . query ( Author ) . filter ( Author . name == a ) . first ( ) author_vec = ProfileOneHotEncoder . add_info_to_vec ( author . vector , author . gender , author . localisation , author . emotion ) . reshape ( 1 , - 1 ) sim = cosine_similarity ( self . user_vec , author_vec ) reranked_reco . append ( { 'author_name' : a , 'sim' : sim [ 0 ] } ) return sorted ( reranked_reco , key = lambda k : k [ 'sim' ] , reverse = True )
rerank results from authors_prio based on their similarity with the user
rerank results from authors_prio based on their similarity with the user
"""
		rerank results from authors_prio based on their similarity with the user
		:param authors_prio: the jaccard coefficient for the link prediction between the user and each kept author
		:return:
		"""
None
self
authors_prio
the jaccard coefficient for the link prediction between the user and each kept author
the jaccard coefficient for the link prediction between the user and each kept author