annealing paths for the evaluation of topic models james foulds padhraic smyth department of...

45
Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James Foulds has recently moved to the University of California, Santa Cruz

Upload: arron-owen

Post on 12-Jan-2016

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

Annealing Paths for the Evaluation of Topic Models

James FouldsPadhraic Smyth

Department of Computer ScienceUniversity of California, Irvine*

*James Foulds has recently moved to the University of California, Santa Cruz

Page 2: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

2

Motivation

• Topic model extensions– Structure, prior knowledge and constraints

• Sparse, nonparametric, correlated, tree-structured, time series, supervised, focused, determinantal…

– Special-purpose models• Authorship, scientific impact, political affiliation,

conversational influence, networks, machine translation…

– General-purpose models• Dirichlet multinomial regression (DMR), sparse additive generative (SAGE)… Structural topic model (STM)

Page 3: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

3

Motivation

• Topic model extensions – Structure, prior knowledge and constraints

• Sparse, nonparametric, correlated, tree-structured, time series, supervised, focused, determinantal…

– Special-purpose models• Authorship, scientific impact, political affiliation,

conversational influence, networks, machine translation…

– General-purpose models• Dirichlet multinomial regression (DMR), sparse additive generative (SAGE)… Structural topic model (STM)

Page 4: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

4

Motivation

• Topic model extensions– Structure, prior knowledge and constraints

• Sparse, nonparametric, correlated, tree-structured, time series, supervised, focused, determinantal…

– Special-purpose models• Authorship, scientific impact, political affiliation,

conversational influence, networks, machine translation…

– General-purpose models• Dirichlet multinomial regression (DMR), sparse additive generative (SAGE), Structural topic model (STM), …

Page 5: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

5

Motivation

• Inference algorithms for topic models

– Optimization• EM, variational inference, collapsed variational inference,…

– Sampling• Collapsed Gibbs sampling, Langevin dynamics,…

– Scaling to ``big data’’• Stochastic algorithms, distributed algorithms, map reduce…

Page 6: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

6

Motivation

• Inference algorithms for topic models

– Optimization• EM, variational inference, collapsed variational inference,…

– Sampling• Collapsed Gibbs sampling, Langevin dynamics,…

– Scaling to ``big data’’• Stochastic algorithms, distributed algorithms, map reduce…

Page 7: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

7

Motivation

• Inference algorithms for topic models

– Optimization• EM, variational inference, collapsed variational inference,…

– Sampling• Collapsed Gibbs sampling, Langevin dynamics,…

– Scaling up to ``big data’’• Stochastic algorithms, distributed algorithms, map reduce, sparse data structures…

Page 8: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

8

Motivation

• Which existing techniques should we use?

• Is my new model/algorithm better than previous methods?

Page 9: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

9

Evaluating Topic Models

Training set Test set

Page 10: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

10

Evaluating Topic Models

Training set Test set

Topic model

Page 11: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

11

Evaluating Topic Models

Training set Test set

Topic model Predict:

Page 12: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

12

Evaluating Topic Models

Training set Test set

Topic model Predict: Log Pr( )

Page 13: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

13

Evaluating Topic Models

• Fitting these models only took a few hours on a single core single core machine.

• Creating this plot required a cluster

(Foulds et al., 2013)

Page 14: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

14

Why is this Difficult?

• For every held-out document d, we need to estimate

• We need to approximate possibly tens of thousands of intractable sums/integrals!

Page 15: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

15

Annealed Importance Sampling(Neal, 2001)

• Scales up importance sampling to high dimensional data, using MCMC

• Corrects for MCMC convergence failures using importance weights

Page 16: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

16

Annealed Importance Sampling(Neal, 2001)

low “temperature”

Page 17: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

17

Annealed Importance Sampling(Neal, 2001)

low “temperature”high “temperature”

Page 18: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

18

Annealed Importance Sampling(Neal, 2001)

low “temperature”high “temperature”

Page 19: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

19

Annealed Importance Sampling(Neal, 2001)

Page 20: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

20

Annealed Importance Sampling(Neal, 2001)

• Importance samples from the target

• An estimate of the ratio of partition functions

Page 21: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

21

AIS for Evaluating Topic Models(Wallach et al., 2009)

Draw from the prior Anneal towards The posterior

Page 22: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

22

AIS for Evaluating Topic Models(Wallach et al., 2009)

Draw from the prior Anneal towards The posterior

Page 23: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

23

AIS for Evaluating Topic Models(Wallach et al., 2009)

Draw from the prior Anneal towards The posterior

Page 24: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

24

AIS for Evaluating Topic Models(Wallach et al., 2009)

Draw from the prior Anneal towards The posterior

Page 25: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

25

Insights

1. We are mainly interested in therelative performance of topic models

2. AIS can provide estimates of the ratio of partition functions of any two distributions that we can anneal between

Page 26: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

26

low “temperature”high “temperature”

A standard application of Annealed Importance Sampling (Neal, 2001)

Page 27: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

27

The Proposed Method:Ratio-AIS

Draw from Topic Model 2 Anneal towards Topic Model 1

medium “temperature”medium “temperature”

Page 28: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

28

The Proposed Method:Ratio-AIS

medium “temperature”medium “temperature”

Draw from Topic Model 2 Anneal towards Topic Model 1

Page 29: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

29

The Proposed Method:Ratio-AIS

medium “temperature”medium “temperature”

Draw from Topic Model 2 Anneal towards Topic Model 1

Page 30: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

30

Advantages of Ratio-AIS

• Ratio-AIS avoids several sources of Monte Carlo error for comparing two models. The standard method– estimates the denominator of a ratio even though it is

a constant (=1),– uses different z’s for both models,– and is run twice, introducing Monte Carlo noise each time.

• An easy convergence check: anneal in thereverse direction to compute the reciprocal.

Page 31: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

31

Annealing Paths BetweenTopic Models

• Geometric average of the two distributions

• Convex combination of the parameters

Page 32: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

32

Efficiently Plotting PerformancePer Iteration of the Learning Algorithm

(Foulds et al., 2013)

Page 33: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

33

Insights

1. Fsf2. 2sfd3. We can select the AIS intermediate distributions

to be distributions of interest

4. The sequence of models we reach during training is typically amenable to annealing– The early models are often low temperature– Each successive model is similar to the previous one

Page 34: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

34

Iteration-AIS

• Re-uses all previous computation• Warm starts• More annealing temperatures, for free• Importance weights can be computed recursively

Anneal from Prior Iteration 1 Iteration 2 … Iteration N

Wallach et al.

Ratio AIS

Ratio AIS

Ratio AIS

Topic Model at

Topic Model at

Topic Model at

Page 35: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

35

Iteration-AIS

• Re-uses all previous computation• Warm starts• More annealing temperatures, for free• Importance weights can be computed recursively

Anneal from Prior Iteration 1 Iteration 2 … Iteration N

Wallach et al.

Ratio AIS

Ratio AIS

Ratio AIS

Topic Model at

Topic Model at

Topic Model at

Page 36: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

36

Comparing Very Similar Topic Models (ACL Corpus)

Page 37: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

37

Comparing Very Similar Topic Models (ACL and NIPS)

NIPS (ch

eap)

NIPS (exp

ensive)

ACL (ch

eap)

ACL (exp

ensive)

0102030405060708090

100

Left to RightStandard AISRatio-AIS (geo.)Ratio-AIS (geo., rev.)Ratio-AIS (convex)Ratio-AIS (convex, rev.)

% A

ccur

acy

Page 38: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

38

Symmetric vs Asymmetric Priors(NIPS, 1000 temperatures or equiv.)

Correlation with longer left-to-right run

Variance of the estimate of relative log-likelihood

Page 39: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

39

Symmetric vs Asymmetric Priors(NIPS, 1000 temperatures or equiv.)

Correlation with longer left-to-right run

Variance of the estimate of relative log-likelihood

Page 40: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

40

Symmetric vs Asymmetric Priors(NIPS, 1000 temperatures or equiv.)

Correlation with longer left-to-right run

Variance of the estimate of relative log-likelihood

Page 41: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

41

Per-Iteration Evaluation, ACL Dataset

Page 42: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

42

Per-Iteration Evaluation, ACL Dataset

Page 43: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

43

Conclusions

• Use Ratio-AIS for detailed document-level analysis

• Run the annealing in both directions to check for convergence failures

• Use Left to Right for corpus-level analysis

• Use Iteration-AIS to evaluate training algorithms

Page 44: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

44

Future Directions

• The ratio-AIS and iteration-AIS ideas can potentially be applied to other models with intractable likelihoods or partition functions (e.g. RBMs, ERGMs)

• Other annealing paths may be possible

• Evaluating topic models remains an important, computationally challenging problem

Page 45: Annealing Paths for the Evaluation of Topic Models James Foulds Padhraic Smyth Department of Computer Science University of California, Irvine* *James

45

Thank You!

Questions?