Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TF-Ranking: Scalable TensorFlow Library for Learning-to-Rank #163

Open
chullhwan-song opened this issue Jul 5, 2019 · 1 comment
Open

Comments

@chullhwan-song
Copy link
Owner

chullhwan-song commented Jul 5, 2019

https://arxiv.org/abs/1812.00073
https://github.com/tensorflow/ranking

@chullhwan-song
Copy link
Owner Author

chullhwan-song commented Jul 8, 2019

LEARNING-TO-RANK

Setup

  • imagex(항목, item) 들을 가진 ranking list.
    • rank r
  • image 랭킹 리스트 에서의 index를 return, i는 r의 index
  • learning-to-rank의 목적은 넓은 의미에서, ranking 함수 f를 학습데이터를 통해 학습하는 것이다. 이때 f에 의해 정렬(ordered)된 항목들이(items) 쵀대의 효용을 얻을수 있도록하는것.

Training Data

  • set of permutations == a partial ranking
    image
  • task == ad hoc retrieval
    • As a concrete example, consider the task of ad hoc retrieval where given a (textual) query the ranking algorithm retrieves a relevant list of documents from a large corpus.
  • 학습셋 구성
    • 보통 전문가들이 query에 대한 랭킹리스트(set of permutations)를 만든다.
    • user feedback = click log 를 고려할수 있음.
  • image : 정확한 total ranking
    • 라벨 y를 가진 리스트로 유도된 랭킹.

Utility and Ranking Metrics

  • tf-ranking lib은 다음과같은 metrics 제공.
    image
    image

Loss Functions

  • 이 lib에제공되는, point-wise loss, pairwise loss, list-wise loss, Softmax Cross-Entropy, ListNet, ListMLE

Item Weighting

  • 사용자는 낮은 순위의 item들을 잘 click하지않는 속성을 지님
  • 이러한 속성을 무시하고 만든 model은 문제가 발생 > less generalization capacity and inaccurate quality measurements
  • 그래서, "Unbiased learning-to-rank"
    • 이 방법은 Inverse Propensity Weights (IPW)를 계산.

PLATFORM OVERVIEW

image

  • TensorFlow Ranking
  • tf 장점이라고 늘어놓음.ㅠ (paper 참고..) > 이러해서 tf를 선택..^^;;

COMPONENTS

(1) data reader
(2) transform function
(3) scoring function
(4) ranking loss functions
(5) evaluation metrics
(6) ranking head
(7) a model_fn builder

Reading data using input_fn

  • data reader
  • Fig.1의 input_fn
  • 다양한 data format 제공 = LIBSVM, tf.SequenceExample
    image
    • input format을 먼저 설명해야하는게 아닌가?
  • libsvm format를 제공하니..여기서 힌트를 얻자.
    • 소스 안에서는 요런 예제가 있다.
For example:
1 qid:10 32:0.14 48:0.97  51:0.45
0 qid:10 1:0.15  31:0.75  32:0.24  49:0.6
2 qid:10 1:0.71  2:0.36   31:0.58  51:0.12
0 qid:20 4:0.79  31:0.01  33:0.05  35:0.27
3 qid:20 1:0.42  28:0.79  35:0.30  42:0.76
In the above example, the dataset contains two queries. Query "10" has 3
documents, two of which relevant with grades 1 and 2. Similarly, query "20"
has 1 relevant document. Note that query-document pairs may have different
sets of zero-valued features and as such their feature vectors may only
partly overlap or not at all.
  • 한줄에 쿼리에 대한 랭킹 리스트가 있는것이 아니다.
  • 그 쿼리에 대한 1개의 문서(이미지면 1장...)가 있는것이다. =
  • 1th: 젤 앞에 있는게 label
3 qid:1 1:1 2:1 3:0 4:0.2 5:0 # 1A
2 qid:1 1:0 2:0 3:1 4:0.1 5:1 # 1B 
1 qid:1 1:0 2:1 3:0 4:0.4 5:0 # 1C
1 qid:1 1:0 2:0 3:1 4:0.3 5:0 # 1D  
1 qid:2 1:0 2:0 3:1 4:0.2 5:0 # 2A  
2 qid:2 1:1 2:0 3:1 4:0.4 5:0 # 2B 
1 qid:2 1:0 2:0 3:1 4:0.1 5:0 # 2C 
1 qid:2 1:0 2:0 3:1 4:0.2 5:0 # 2D  
2 qid:3 1:0 2:0 3:1 4:0.1 5:1 # 3A 
3 qid:3 1:1 2:1 3:0 4:0.3 5:0 # 3B 
4 qid:3 1:1 2:0 3:0 4:0.4 5:1 # 3C 
1 qid:3 1:0 2:1 3:1 4:0.5 5:0 # 3D

the following set of pairwise constraints is generated (examples are referred to by the info-string after the # character):

1A>1B, 1A>1C, 1A>1D, 1B>1C, 1B>1D, 2B>2A, 2B>2C, 2B>2D, 3C>3A, 3C>3B, 3C>3D, 3B>3A, 3B>3D, 3A>
  • 2th: query 정보
    • 한개의 query에 여러개가 있는 것을 알수 있는데, 그것은 라벨을 보고 랭킹정보를 알수 있고, 위에서 설명한거와 같이, 한문서만 표현한 케이스
  • 3th~: feature
    • index:value인데 zero이면 제거할수 있다.

Feature Transformation with transform_fn

  • Fig1. transform_fn
  • spare feature(word or ngram 형태를 의미) > dense feature(w2v같은 embedding feature) 로 전환
  • dense 2-D : context
  • 3-D tensors : per item features
    image

Feature Interactions using scoring_fn

  • 실제 network 부분
  • 여기서는 3-layer feedforward neural network with ReLUs 예제.
    image

Ranking Losses

  • The loss key is an enum over supported loss functions
    image

Ranking Metrics

  • evaluation - NDCG 예
    image

Ranking Head

  • 앞서 설명한 losses & metrics에 대한 wrapper같음.
    image

Model Builder

  • main정도로...
    image

USE CASES

  • 현재 tf-ranking가 적용된 구글 서비스
    • Gmail search
    • Google Drive안에서의 document recommendation
  • 이들 서비스는 엄청난 click log 데이터를 기반으로 학습
  • RankLib보다 좋다.
  • 게다가 Gmail 서비스에서는, 원래 잘 할수 없는 "sparse textual features"를 잘 적용되도록 모델을 만듦.
    • sparse textual feature > 는 개인적인 유추해보는데...매우 dictionary가 크거나, 희박한...단어..

Gmail Search

  • Gmail는 검색로그를 기반으로 학습. > clicks
  • 익명으로 선택..
  • dense 와 sparse features 두개를 구성
    • dense
    • sparse : word- and character-level n-grams
  • 250M queries
  • Losses & metrics 는 "weighted by Inverse Propensity Weighting"

Document Recommendation in Drive

  • user click data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant