Reranking은 지정된 항목 속성 분포에 순위가 매겨진 항목을 다시 평가하기위한 알고리즘을 제공합니다.
이 패키지는 사후 처리 모듈화 권장 시스템 또는 검색 엔진으로 사용할 수 있습니다.
LinkedIn Talent Search에 응용 프로그램이 포함 된 검색 및 추천 시스템에서 종이 공정성 인식 순위에서 영감을 얻었습니다.
"채용 담당자에게 후보자를 추천하는 것"을 예로 들어 보시는 (논문에서 강조한 LinkedIn 채용 담당자 서비스의 경우), 검색 엔진 순위는 채용 담당자에게 공정한 전시를 고려하여 성별 및 인구 통계 학적 패리티와 같은 보호 된 속성의 분포에 의해 재구성됩니다.
예를 들어, 사용자에게 제품을 추천 할 때 각 사용자의 제품 선호 분포 (구매 로그 또는 뷰 로그에서 얻을 수있는 제품)를 사용하여 추천 시스템을 통해 항목 순위를 다시 평가하여보다 개인화 된 권장 사항을 얻을 수 있습니다.
$ pip install reranking import reranking
item_attribute = [ "a1" , "a1" , "a1" , "a2" , "a1" , "a1" , "a1" , "a2" , "a2" , "a1" ]
desired_distribution = { "a1" : 0.5 , "a2" : 0.5 }
rerank_indices = reranking . rerank (
item_attribute , # attributes of the ranked items
desired_distribution , # desired item distribution
max_na = None , # controls the max number of attribute categories applied
k_max = None , # length of output, if None, k_max is the length of `item_attribute`
algorithm = "det_greedy" , # "det_greedy", "det_cons", "det_relaxed", "det_const_sort"
verbose = False , # if True, the output is with detailed information
)
print ( rerank_indices ) rerank_indices 는 [0, 3, 1, 7, 2, 8, 4, 5, 6, 9] 이며, 이는 원하는 분포에 의해 재 계정 후 항목 지수 목록입니다. 원하는 항목이 충분한 경우 다시 순위 목록의 상단 항목은 원하는 분포와 동일한 분포와 동일한 분포를 갖습니다. ( item_attribute 항목 목록과 동일한 순서를 가지므로 순위/점수 정보가 포함되어 있습니다.)
# Evaluate the before&after of the re-ranking result above
item_attribute_reranked = [ item_attribute [ i ] for i in rerank_indices ]
before = reranking . ndkl ( item_attribute , desired_distribution )
after = reranking . ndkl ( item_attribute_reranked , desired_distribution )
print ( f" { before :.3f } , { after :.3f } " ) before 및 after 는 각각 0.412 및 0.172 이며, 이는 각각 순위가 매겨진 항목 속성 분포의 정규화 된 할인 된 누적 kl 디베이트 (NDKL)입니다. (낮은 것입니다.)
더 많은 예가 여기에서 찾을 수 있습니다.