ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/csci_5622/13a.pdfranking...

27
Ranking Jordan Boyd-Graber University of Colorado Boulder LECTURE 16 Jordan Boyd-Graber | Boulder Ranking | 1 of 1

Upload: others

Post on 01-Sep-2019

18 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Ranking

Jordan Boyd-GraberUniversity of Colorado BoulderLECTURE 16

Jordan Boyd-Graber | Boulder Ranking | 1 of 1

Page 2: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Roadmap

• Combining rankings: taking advantage of multiple weak rankers

• Maximum margin ranking: support vector machines

• Reduction to classification: optimizing

Jordan Boyd-Graber | Boulder Ranking | 2 of 1

Page 3: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Ranking

• Web search (Google uses > 200 features)

• Movie rankings

• Dating

Jordan Boyd-Graber | Boulder Ranking | 3 of 1

Page 4: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

RankBoost

Plan

Jordan Boyd-Graber | Boulder Ranking | 4 of 1

Page 5: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

RankBoost

An Efficient Boosting Algorithm for Combining Preferences

Freund, Iyer, Schapire, Singer. JMLR, 2003.

• Feedback function: Φ : X × X 7→ R◦ φ(x0, x1) > 0: x1 is preferred to x0◦ φ(x0, x1) < 0: x0 is preferred to x1◦ φ(x0, x1) == 0: no preference

• Want to learn distribution D(x0, x1) ≡ c ·max{0,Φ(x0, x1)} s.t.∑x ,x ′

D(x , x ′) = 1 (1)

Jordan Boyd-Graber | Boulder Ranking | 5 of 1

Page 6: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

RankBoost

What’s the goal?

• Minimize the number of misranked pairs under final ranking∑x ,x ′

D(x , x ′) · 1[H(x ′) ≤ H(x)

]= Pr(x ,y)∼D [H(y) ≤ H(x)] (2)

• Choose entries with high weight in D to be important (can’t getthem wrong)

Jordan Boyd-Graber | Boulder Ranking | 6 of 1

Page 7: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

RankBoost

What’s the input

• Weak rankings of the form ht : X 7→ R

• Could be different systems / users / feature sets

• Will combine them into a final ranking of the same form

Jordan Boyd-Graber | Boulder Ranking | 7 of 1

Page 8: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

RankBoost

What’s a weak ranking?

• A function of the form

h(x) =

1 if fi (x) > θ

0 if fi (x) ≤ θqdef if fi (x) == ⊥

(3)

• How to find qdef and θ?

• Binary search over how much it improves ranking implied by D(i.e., gets high D weights right)

Jordan Boyd-Graber | Boulder Ranking | 8 of 1

Page 9: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

RankBoost

What’s a weak ranking?

• A function of the form

h(x) =

1 if fi (x) > θ

0 if fi (x) ≤ θqdef if fi (x) == ⊥

(3)

• How to find qdef and θ?

• Binary search over how much it improves ranking implied by D(i.e., gets high D weights right)

Jordan Boyd-Graber | Boulder Ranking | 8 of 1

Page 10: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

RankBoost

Algorithm

• Initialize D1

• For t = 1 . . .T :◦ Get weak ranking ht : X 7→ R◦ Choose αt

◦ Update distribution

Dt+1(x , y) ∝ Dt(x , y) · exp {αt [ht(x)− ht(y)]} (4)

◦ Final ranking is

H(x) =T∑1

αtht(x) (5)

Jordan Boyd-Graber | Boulder Ranking | 9 of 1

Page 11: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

RankBoost

Learning rate

• αt encodes importance of individual weak learner

• In general decreases over iterations

• Find weighted discrepancy

r =∑x ,y

D(x , y) [h(y)− h(x)] (6)

• Use α = 12 ln

(1+r1−r

)

• As r gets smaller, weak learner t will have lower weight

Jordan Boyd-Graber | Boulder Ranking | 10 of 1

Page 12: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

RankBoost

Learning rate

• αt encodes importance of individual weak learner

• In general decreases over iterations

• Find weighted discrepancy

r =∑x ,y

D(x , y) [h(y)− h(x)] (6)

• Use α = 12 ln

(1+r1−r

)• As r gets smaller, weak learner t will have lower weight

Jordan Boyd-Graber | Boulder Ranking | 10 of 1

Page 13: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

RankBoost

Performance

• Works better than individual features or nearest neighbor

Jordan Boyd-Graber | Boulder Ranking | 11 of 1

Page 14: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Maximum Margin Ranking

Plan

Jordan Boyd-Graber | Boulder Ranking | 12 of 1

Page 15: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Maximum Margin Ranking

Examples as feature vectors

Every example has a feature vector f (x)

Jordan Boyd-Graber | Boulder Ranking | 13 of 1

Page 16: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Maximum Margin Ranking

Turning features to rank

• Have a series of “levels” or ranks y = 1 . . .• We want to find a function to separate examples

f (x) ≡ 〈w · φ(x)〉 (7)

Jordan Boyd-Graber | Boulder Ranking | 14 of 1

Page 17: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Maximum Margin Ranking

Maximizing the margin

Jordan Boyd-Graber | Boulder Ranking | 15 of 1

Page 18: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Maximum Margin Ranking

Using SVM-light

• Each example has a rank

• and a query id

• and lots of features

Jordan Boyd-Graber | Boulder Ranking | 16 of 1

Page 19: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Maximum Margin Ranking

Using SVM-light

# q u e r y 13 q i d : 1 1 : 1 2 : 1 3 : 0 4 : 0 . 2 5 : 02 q i d : 1 1 : 0 2 : 0 3 : 1 4 : 0 . 1 5 : 11 q i d : 1 1 : 0 2 : 1 3 : 0 4 : 0 . 4 5 : 01 q i d : 1 1 : 0 2 : 0 3 : 1 4 : 0 . 3 5 : 0# q u e r y 21 q i d : 2 1 : 0 2 : 0 3 : 1 4 : 0 . 2 5 : 02 q i d : 2 1 : 1 2 : 0 3 : 1 4 : 0 . 4 5 : 01 q i d : 2 1 : 0 2 : 0 3 : 1 4 : 0 . 1 5 : 01 q i d : 2 1 : 0 2 : 0 3 : 1 4 : 0 . 2 5 : 0# q u e r y 32 q i d : 3 1 : 0 2 : 0 3 : 1 4 : 0 . 1 5 : 13 q i d : 3 1 : 1 2 : 1 3 : 0 4 : 0 . 3 5 : 04 q i d : 3 1 : 1 2 : 0 3 : 0 4 : 0 . 4 5 : 11 q i d : 3 1 : 0 2 : 1 3 : 1 4 : 0 . 5 5 : 0

Jordan Boyd-Graber | Boulder Ranking | 17 of 1

Page 20: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Classification and Other Objectives

Plan

Jordan Boyd-Graber | Boulder Ranking | 18 of 1

Page 21: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Classification and Other Objectives

Are all pairs important?

• Often we care about the top of the result list

• Regression (as in previous section) not robust when there’s oneright answer and many wrong ones

• Measured by the auc: area under the curve◦ Imagine two classes: winners and losers◦ We want there to be a consecutive run of winners before losers in the

results (extends to greater number of classes)◦ Want to minimize probability of losers before winners in an ordering π

on a set of examples S = (x1, y1) . . .

l(π,S) =

∑i 6=j 1 [yi > yj ]π(xi , xj)∑

i<j 1 [yi 6= yj ](8)

Jordan Boyd-Graber | Boulder Ranking | 19 of 1

Page 22: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Classification and Other Objectives

roc curve

Jordan Boyd-Graber | Boulder Ranking | 20 of 1

Page 23: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Classification and Other Objectives

Reduction to Classification

Robust Reductions from Ranking to Classification

Maria-Florina Blcan, Nikhil Bansal, Alina Beygelzimer, DonCoppersmith, John Langford, Gregory B. Sorkin. JMLR, 2008.

• Produces a ranking using a classifier

• If regret of classifier is r , loss of classifier is at most 2r

• Thus, if binary error rate is 20% due to inherent noise and 5% dueto errors made by the classifier

• Then auc regret is at most 10%

Jordan Boyd-Graber | Boulder Ranking | 21 of 1

Page 24: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Classification and Other Objectives

Algorithm

• Learn a classifier◦ Given a random pair of examples, learn a classifier c to predict

whether it should prefer x1 to x2◦ Return the classifier c

• Get a ranking from the resulting classifier tournament◦ For an example x , define the degree

deg(x) = |{x ′ : c(x , x ′) == 1, x ′ ∈ U| (9)

◦ Sort by the degree of the node (number of matches it won)

Jordan Boyd-Graber | Boulder Ranking | 22 of 1

Page 25: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Classification and Other Objectives

Efficiency

• For ranking a large list, complexity O(n2) is unnacceptable

• Possible to use variant of QuickSort O(n log n)

• Has the same regret performance, but is randomized

Jordan Boyd-Graber | Boulder Ranking | 23 of 1

Page 26: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Classification and Other Objectives

Training Preference Classifier

• How do you balance positive and negative classes?

• Requires cross-validation: try many options on held out data

• Weighting positive classes is important:◦ Some frameworks allow you to weight examples◦ In other cases, you can just duplicate positive

Jordan Boyd-Graber | Boulder Ranking | 24 of 1

Page 27: Ranking - legacydirs.umiacs.umd.edulegacydirs.umiacs.umd.edu/~jbg/teaching/CSCI_5622/13a.pdfRanking Web search (Google uses >200 features) Movie rankings Dating Jordan Boyd-Graber

Classification and Other Objectives

Recap

• Ranking is an important problem

• Multiple approaches◦ Combining weak rankers◦ Max-margin◦ Tournament classification

Jordan Boyd-Graber | Boulder Ranking | 25 of 1