Word embeddings Rappel Embeddings ( pas Word Embeddings ) Est une - - PowerPoint PPT Presentation

word embeddings rappel embeddings pas word embeddings est
SMART_READER_LITE
LIVE PREVIEW

Word embeddings Rappel Embeddings ( pas Word Embeddings ) Est une - - PowerPoint PPT Presentation

Word embeddings Rappel Embeddings ( pas Word Embeddings ) Est une lookup table Formalisme: Index dun mot: w i Table dembeddings (lookup matrix): V Embedding: e i e i = V( w i ) Reprsentation dun mot


slide-1
SLIDE 1

Word embeddings

slide-2
SLIDE 2

Rappel Embeddings (pas Word Embeddings)

slide-3
SLIDE 3

Est une “lookup table”

Formalisme:

  • Index d’un mot: wi
  • Table d’embeddings (lookup matrix): V
  • Embedding: ei
  • ei = V(wi)
slide-4
SLIDE 4

Représentation d’un mot

Différentes possibilités:

  • Vecteur One-hot

○ Chat: [0,0,… 0,1,0,0,0,0,0,0,0,0,0…]

  • Vecteur de context

○ Chat: [1,0,… 0,0,0,0,0,1,0,0,1,0,0…]

félin chat litière lait

slide-5
SLIDE 5

Vecteurs de contexte

“Chap. 15: Vector Semantics.” Speech and Language Processing: an Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition, by Dan Jurafsky and James H. Martin, Dorling Kindersley Pvt, Ltd., 2014.

slide-6
SLIDE 6

Vecteurs de contexte

“Chap. 15: Vector Semantics.” Speech and Language Processing: an Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition, by Dan Jurafsky and James H. Martin, Dorling Kindersley Pvt, Ltd., 2014.

slide-7
SLIDE 7

Vecteurs de contexte

“Chap. 15: Vector Semantics.” Speech and Language Processing: an Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition, by Dan Jurafsky and James H. Martin, Dorling Kindersley Pvt, Ltd., 2014.

slide-8
SLIDE 8

Vecteurs de contexte

“Chap. 15: Vector Semantics.” Speech and Language Processing: an Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition, by Dan Jurafsky and James H. Martin, Dorling Kindersley Pvt, Ltd., 2014.

slide-9
SLIDE 9
  • Vecteurs très grands (taille du vocabulaire)
  • Contiennent beaucoup de 0
  • On cherche donc une manière de réduire la dimensionnalité

pour: ○ Efficacité en mémoire ○ Facile d’utilisation pour des classificateurs ○ Moins de paramètres ○ Des dimensions peuvent se recouper

Vecteurs de contexte

slide-10
SLIDE 10

Décomposition en valeurs singulières

“Chap. 15: Vector Semantics.” Speech and Language Processing: an Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition, by Dan Jurafsky and James H. Martin, Dorling Kindersley Pvt, Ltd., 2014.

slide-11
SLIDE 11

On conserve les top k valeurs singulières

“Chap. 15: Vector Semantics.” Speech and Language Processing: an Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition, by Dan Jurafsky and James H. Martin, Dorling Kindersley Pvt, Ltd., 2014.

slide-12
SLIDE 12

On utilise ensuite seulement la matrice W

“Chap. 15: Vector Semantics.” Speech and Language Processing: an Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition, by Dan Jurafsky and James H. Martin, Dorling Kindersley Pvt, Ltd., 2014.

slide-13
SLIDE 13

Méthodes à réseaux de neurones

slide-14
SLIDE 14

“A weighted least squares regression model” L’idée est de prédire le nombre de co-occurrences Xij (ou le log) des mots wi et wj S’apparente à Word2Vec (ou encore FastText)

GloVe

slide-15
SLIDE 15

GloVe

wi wj 25

slide-16
SLIDE 16

GloVe

Perte = v(wi) * v(wj) + bi + bj - log(Xij)

slide-17
SLIDE 17

GloVe

Perte = v(wi) * v(wj) + bi + bj - log(25)

slide-18
SLIDE 18

Word2Vec

2 algorithmes:

  • Skip-Gram
  • CBOW (Contextual Bag of Words)
slide-19
SLIDE 19

Word2Vec

slide-20
SLIDE 20

CBOW

slide-21
SLIDE 21

CBOW

slide-22
SLIDE 22

CBOW - Negative Sampling

softmax chat litière

slide-23
SLIDE 23

CBOW - Negative Sampling

chat litière café pomme feuille

slide-24
SLIDE 24

CBOW - Negative Sampling

score entre un mot w et un context C

slide-25
SLIDE 25

CBOW - Comment obtenir un score

Produit vectoriel entre vC et vw

slide-26
SLIDE 26

CBOW - Comment obtenir un score

= <wh, whe, her, ere, re>, <where>

slide-27
SLIDE 27

CBOW - Phrase Representations

v(New) + v(York) ≈ Boston?

slide-28
SLIDE 28

CBOW - Phrase Representations

v(New) + v(York) ≈ Issshhh?

slide-29
SLIDE 29

CBOW - Phrase Representations

New York => New_York

slide-30
SLIDE 30

Démo FastText

slide-31
SLIDE 31

Recap FastText

… le petit chat saute sur ...

slide-32
SLIDE 32

Recap FastText

chat

[0.2, 1.3, 3.4] wi

le petit saute sur

[-2.2, 2.3, 2.4] [-0.2, -1.3, 0.4] [-3.2, 1.3, 0.5] c1 c2 c3 [-3.2, 1.3, 0.5] c4 C score + score

marteau

[1.2, -1.3, -3.4] ni

  • Negative sampling:
slide-33
SLIDE 33

ELMo

On le verra dans la section modèles de langue..!

slide-34
SLIDE 34

Vecteurs de phrases

slide-35
SLIDE 35

Comment obtenir la représentation d’une phrase?

  • Prendre la moyenne des embeddings de mots
  • Utiliser une idée similaire à Skip-Gram!
slide-36
SLIDE 36

Skip-Thought Vectors

Idée de base:

  • Étant donné un triplet de phrases (si-1, si, si+1)

○ Encoder la phrase si ○ Générer les phrases si-1 et si+1

slide-37
SLIDE 37

Skip-Thought Vectors

slide-38
SLIDE 38

Skip-Thought Vectors

slide-39
SLIDE 39

Skip-Thought Vectors

slide-40
SLIDE 40

Skip-Thought Vectors

slide-41
SLIDE 41

Skip-Thought Vectors

slide-42
SLIDE 42

Skip-Thought Vectors

slide-43
SLIDE 43

Skip-Thought Vectors

slide-44
SLIDE 44

Skip-Thought Vectors

slide-45
SLIDE 45

Skip-Thought Vectors

Modèles de langue

slide-46
SLIDE 46

Skip-Thought Vectors

Au final, on se sert de ça!

slide-47
SLIDE 47

Skip-Thought Vectors

Probabilité d’avoir généré la phrase suivante Probabilité d’avoir généré la phrase précédente