word2vec Tom Kenter IR Reading Group September 12 2014 - - PowerPoint PPT Presentation

word2vec
SMART_READER_LITE
LIVE PREVIEW

word2vec Tom Kenter IR Reading Group September 12 2014 - - PowerPoint PPT Presentation

word2vec Tom Kenter IR Reading Group September 12 2014 Word2vec: what is it (not)? It is: Neural network-based Word embeddings Mapping


slide-1
SLIDE 1

word2vec ¡

Tom ¡Kenter ¡ IR ¡Reading ¡Group ¡ September ¡12 ¡2014 ¡

slide-2
SLIDE 2

Word2vec: ¡what ¡is ¡it ¡(not)? ¡

It ¡is: ¡

  • Neural ¡network-­‑based ¡
  • Word ¡embeddings ¡
  • Mapping ¡to ¡semanHcal/syntacHcal ¡space ¡
  • Co-­‑occurrence-­‑based ¡

It ¡is ¡not: ¡

  • Deep ¡learning ¡
slide-3
SLIDE 3

Two ¡architectures ¡

Skip-­‑gram ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡CBOW ¡ ¡ Neither ¡has ¡a ¡hidden ¡layer, ¡only ¡a ¡projecHon ¡ layer: ¡

  • Predict ¡a ¡missing ¡word ¡given ¡a ¡window ¡of ¡

context ¡words ¡(Skip-­‑gram) ¡

  • Predict ¡context ¡words ¡given ¡a ¡word ¡(CBOW: ¡

ConHnuous ¡Bag ¡Of ¡Words) ¡

slide-4
SLIDE 4

Two ¡architectures ¡

Figure ¡from ¡[4] ¡

slide-5
SLIDE 5

Advantages ¡

  • It ¡scales ¡

– Train ¡on ¡billion ¡word ¡corpora ¡ – In ¡limited ¡Hme ¡ – Mikolov ¡menHons ¡parallel ¡training ¡

  • Word ¡embeddings ¡trained ¡by ¡one ¡can ¡be ¡used ¡by ¡
  • thers. ¡

For ¡enHrely ¡different ¡tasks. ¡ This ¡happens ¡indeed! ¡

  • Incremental ¡training ¡

Train ¡on ¡one ¡piece ¡of ¡data, ¡save ¡results, ¡conHnue ¡training ¡ later ¡on ¡

  • There ¡is ¡a ¡very ¡nice ¡Python ¡module ¡for ¡it! ¡

– Gensim ¡word2vec ¡

h[p://radimrehurek.com/2014/02/word2vec-­‑tutorial/ ¡

slide-6
SLIDE 6

What ¡can ¡you ¡do ¡with ¡it? ¡

A ¡is ¡to ¡B ¡as ¡C ¡is ¡to ¡? ¡ ¡ This ¡is ¡the ¡famous ¡example: ¡ vector(king) ¡– ¡vector(man) ¡+ ¡vector(woman) ¡ = ¡ vector(queen) ¡ ¡ Actually, ¡what ¡the ¡original ¡paper ¡says ¡is: ¡if ¡you ¡substract ¡ the ¡vector ¡for ¡‘man’ ¡from ¡the ¡one ¡for ¡‘king’ ¡and ¡add ¡the ¡ vector ¡for ¡‘woman’, ¡the ¡vector ¡closest ¡to ¡the ¡one ¡you ¡end ¡ up ¡with ¡turns ¡out ¡to ¡be ¡the ¡one ¡for ¡‘queen’. ¡

slide-7
SLIDE 7

What ¡can ¡you ¡do ¡with ¡it? ¡

A ¡is ¡to ¡B ¡as ¡C ¡is ¡to ¡? ¡ ¡ More ¡interesHng: ¡which ¡country ¡does ¡a ¡ parHcular ¡city ¡belong ¡to? ¡ ¡ France ¡is ¡to ¡Paris ¡as ¡Germany ¡is ¡to ¡Berlin. ¡ ¡

slide-8
SLIDE 8

Why ¡does ¡this ¡happen? ¡

Figure ¡from ¡[5] ¡

slide-9
SLIDE 9

What ¡can ¡you ¡do ¡with ¡it? ¡

A ¡is ¡to ¡B ¡as ¡C ¡is ¡to ¡? ¡ ¡ It ¡also ¡works ¡for ¡syntacHc ¡relaHons: ¡ ¡ X ¡= ¡vector(biggest) ¡-­‑ ¡vector(big) ¡+ ¡vector(small). ¡ ¡ ¡ X ¡= ¡vector(smallest) ¡

slide-10
SLIDE 10

EvaluaHon ¡

  • Mikolov ¡presents ¡an ¡evaluaHon ¡set ¡in ¡[4] ¡ ¡

Seman&c ¡ 8869 ¡

  • f ¡these ¡

¡ Syntac&c ¡ 10675 ¡

  • f ¡these ¡

Table ¡from ¡[4] ¡

slide-11
SLIDE 11

EvaluaHon ¡

Table ¡from ¡[4] ¡

slide-12
SLIDE 12

What ¡can ¡you ¡do ¡with ¡it? ¡

  • Sentence ¡compleHon ¡

Microsoi ¡Sentence ¡CompleHon ¡Challenge ¡ ¡

  • SelecHng ¡out-­‑of-­‑the-­‑list ¡words ¡ ¡

Example: ¡which ¡word ¡does ¡not ¡belong ¡in ¡ [monkey, ¡lion, ¡dog, ¡truck] ¡

  • Bilingual ¡Word ¡Embeddings ¡for ¡Phrase-­‑Based ¡

Machine ¡TranslaHon. ¡EMNLP. ¡2013. ¡

  • Synonym ¡detecHon ¡ ¡

Choose ¡among ¡4 ¡candidates ¡which ¡one ¡is ¡the ¡best ¡ synonym ¡for ¡a ¡given ¡word. ¡

slide-13
SLIDE 13

What ¡can ¡you ¡do ¡with ¡it? ¡

  • Sentence ¡compleHon ¡

Microsoi ¡Sentence ¡CompleHon ¡Challenge ¡ ¡

  • SelecHng ¡out-­‑of-­‑the-­‑list ¡words ¡ ¡

Example: ¡which ¡word ¡does ¡not ¡belong ¡in ¡ [monkey, ¡lion, ¡dog, ¡truck] ¡

  • Bilingual ¡Word ¡Embeddings ¡for ¡Phrase-­‑Based ¡

Machine ¡TranslaHon. ¡EMNLP. ¡2013. ¡

  • Synonym ¡detecHon ¡ ¡

Choose ¡among ¡4 ¡candidates ¡which ¡one ¡is ¡the ¡best ¡ synonym ¡for ¡a ¡given ¡word. ¡

Live ¡demo ¡

slide-14
SLIDE 14

What ¡can ¡you ¡do ¡with ¡it? ¡

  • Concept ¡categorizaHon ¡

Group ¡helicopter ¡and ¡motorcycle ¡together, ¡ and ¡dog ¡an ¡elephant ¡

  • SelecHonal ¡preference ¡

Predict ¡typical ¡verb ¡noun ¡pairs. ¡Like ¡people ¡go ¡ well ¡with ¡to ¡eat ¡as ¡a ¡subject ¡(but ¡not ¡as ¡an ¡

  • bject). ¡
slide-15
SLIDE 15

Seeing ¡changes ¡in ¡ word ¡meaning/usage ¡over ¡Hme ¡

Figure ¡from ¡[3] ¡

slide-16
SLIDE 16

Dealing ¡with ¡phrases ¡

  • Deal ¡with ¡this ¡during ¡pre-­‑processing ¡step ¡

Find ¡collocaHons ¡the ¡usual ¡way, ¡and ¡feed ¡them ¡as ¡single ¡‘words’ ¡to ¡ the ¡NN ¡ ¡

  • Just ¡add/average/concatenate ¡the ¡vectors ¡

This ¡is ¡be[er ¡than ¡the ¡previous ¡approach ¡if ¡you ¡happen ¡to ¡be ¡ dealing ¡with ¡enHHes ¡like ¡Bengal ¡Ager ¡versus ¡Sumatran ¡Tiger ¡ ¡

  • Paragraph2vec ¡

Make ¡fixed-­‑length ¡representaHon ¡of ¡variable-­‑length ¡input ¡

  • Build ¡a ¡convoluHonal ¡NN ¡on ¡top ¡of ¡word2vec ¡

This ¡is ¡done ¡in ¡[2] ¡for ¡sentence ¡classificaHon ¡

slide-17
SLIDE 17

Disadvantages/challenges/future ¡ research ¡

  • Ambiguity ¡

What ¡if ¡there ¡are ¡two ¡Amsterdams..??? ¡

  • EvaluaHon ¡is ¡only ¡extrinsic ¡

(but ¡this ¡goes ¡for ¡rankers ¡as ¡well) ¡

  • Parameter ¡seong ¡involves ¡magic/luck/trial ¡and ¡error ¡

There ¡is ¡no ¡such ¡thing ¡as ¡free ¡lunch ¡

  • Very ¡picky ¡on ¡literal ¡words ¡

But ¡this ¡affects ¡all ¡other ¡word-­‑based ¡methods ¡as ¡well ¡

  • Can ¡not ¡deal ¡with ¡OOV ¡words ¡

If ¡a ¡word ¡is ¡met ¡at ¡tesHng ¡Hme ¡that ¡was ¡not ¡seen ¡at ¡training ¡Hme, ¡it ¡will ¡ simply ¡be ¡ignored. ¡

slide-18
SLIDE 18

Who ¡are ¡the ¡associated ¡names ¡

  • Mikolov ¡(Google) ¡
  • Bengio ¡(of ¡Deep ¡Learning ¡fame) ¡

He ¡already ¡proposed ¡NN ¡LMs ¡and ¡word ¡ embeddings ¡a ¡decade ¡ago ¡

  • Socher ¡
slide-19
SLIDE 19

(By ¡no ¡means ¡extensive) ¡list ¡of ¡papers ¡

Overview ¡and ¡evaluaAon ¡of ¡many ¡different ¡tasks ¡ [1] ¡ ¡M. ¡Baroni, ¡G. ¡Dinu, ¡and ¡G. ¡Kruszewski. ¡Dont ¡count, ¡predict! ¡a ¡systemaHc ¡comparison ¡of ¡context-­‑ counHng ¡vs. ¡context-­‑predicHng ¡semanHc ¡vectors. ¡In ¡Proceedings ¡of ¡the ¡52nd ¡Annual ¡MeeHng ¡of ¡the ¡ AssociaHon ¡for ¡ComputaHonal ¡LinguisHcs, ¡volume ¡1, ¡2014. ¡ ¡ Sentence ¡classificaAon ¡ ¡ [2] ¡ ¡Y. ¡Kim. ¡ConvoluHonal ¡neural ¡networks ¡for ¡sentence ¡classificaHon. ¡ ¡ ¡ This ¡is ¡where ¡the ¡‘gay’ ¡and ¡‘cell’ ¡example ¡came ¡from ¡ [3] ¡ ¡Y. ¡Kim, ¡Y.-­‑I. ¡Chiu, ¡K. ¡Hanaki, ¡D. ¡Hedge, ¡and ¡S. ¡Petrov. ¡Temporal ¡analysis ¡of ¡ ¡ language ¡through ¡neural ¡language ¡models, ¡2014. ¡ ¡ ¡ For ¡more ¡elaborate ¡discussion ¡on ¡the ¡architectures ¡used ¡ [4] ¡ ¡T. ¡Mikolov, ¡K. ¡Chen, ¡G. ¡Corrado, ¡and ¡J. ¡Dean. ¡Efficient ¡esHmaHon ¡of ¡word ¡ ¡ representaHons ¡in ¡vector ¡space. ¡arXiv ¡preprint ¡arXiv:1301.3781, ¡2013. ¡ ¡ ¡ More ¡on ¡Skip-­‑gram, ¡negaAve ¡sampling, ¡hierarchical ¡soMmax, ¡and ¡dealing ¡with ¡phrases ¡ [5] ¡ ¡T. ¡Mikolov, ¡I. ¡Sutskever, ¡K. ¡Chen, ¡G. ¡S. ¡Corrado, ¡and ¡J. ¡Dean. ¡Distributed ¡representaHons ¡of ¡words ¡and ¡ phrases ¡and ¡their ¡composiHonality. ¡In ¡Advances ¡in ¡Neural ¡InformaHon ¡Processing ¡Systems, ¡pages ¡3111– 3119, ¡2013. ¡ ¡ ¡ Link ¡to ¡the ¡demo ¡(scroll ¡down ¡a ¡bit ¡to ¡where ¡it ¡says ¡‘Bonus ¡App’) ¡ h[p://radimrehurek.com/2014/02/word2vec-­‑tutorial/ ¡ ¡