Einführung in NLP mit Deep Learning - inovex · 2019-03-13 · Einführung in NLP mit Deep...

Preview:

Citation preview

Einführung in NLP mit Deep Learning

Minds mastering Machines, Köln, 26.4.2018

Hans-Peter Zorn

‣ Zusammenfassung – „aggregated reviews“

‣ Dokumentklassifikation

‣ Übersetzung

‣ Dialogsysteme / Chatbots

‣ Question Answering

‣ „AI“

NLP ist auf einmal überall

2

Deep Learning

Matthew Honnibal, explosion.io (SpaCy) -

Embed, Encode,

Attend, Predict –The new deep learning formula for state-of-the-

art NLP models

https://explosion.ai/blog/deep-learning-formula-nlp 3

Ein neuronales Netz

4

X

Hidden

Y

Repräsentation von SpracheBag-of-Words, Vectorspace-Model

Embeddings 5

Wenn fliegen hinter fliegen fliegen, fliegen fliegen nach

Wenn 1Fliegen 2Hinter 3Nach 4

1

5

1

1

Embed Encode Attend Predict

VectorspaceModellEmbed

Embeddings 7

00000100

ID

1 0.905 0.505 0.8750

2 .5992 .1213 .6020

3 .8355 .758 .5278

Emdedding Table/Layer

8

▸ Effizientes Mapping von Merkmalen zu Embeddings

▸ Gewichte beim Training gelernt

Pre-trained embeddingsWord2vec, GloVe, fastText

9

King

Queen

Woman▸ Große Corpora:

CommonCrawl, Wikipedia

▸ CBOW, Skip-gram, Character-ngrams(Morphologie)

Embed Encode Attend Predict

Recurrent Neural Networks

11

▸ Input wird schrittweise dem Netz präsentiert

▸ Output ist Input für den nächsten Schritt

▸ CNN auch möglich„wenn“„hinter“„Fliegen“

Recurrent Neural Networks„unfolded“

12

A A A A

▸ Timesteps▸ Long-term dependencies

▸ LSTM/GRU▸ Padding notwendig

wenn fliegen hinter fliegen

Encoder-Decoder (Seq2Seq)Neural machine translation

Sequence to Sequence Learning with Neural Networks, Ilya Sutskever, Oriol Vinyals, Quoc V. Le, 2014 13

Wenn fliegen hinter fliegen

When flies fly behind

▸ Input reversed

Fliegen hinter fliegen wenn

Embed Encode Attend Predict

Les Chatfield/Flickr

Attention

https://www.tensorflow.org/tutorials/seq2seq, CC-BY 3.0 15

Embed Encode Attend Predict

Predict

▸ Klassifikation (softmax)

▸ Sentiment

▸ Inhalt

▸ Decoder

▸ Zusammenfassung

▸ Keyword Extraction

▸ …

17

Masterarbeit Sebastian Blank, inovex/KIT-AIFB

Example: Using Natural Language

to Query noSQL Databases

Predict 18

Fragen in natürlicher Sprache an Elasticsearch

“Who was the writer of true lies?”

19

model

James Cameron, Claude Zidi

Fragen in natürlicher Sprache an Elasticsearch

20

Question

Query

Answer

“Who was the writer of true lies?”

model

James Cameron, Claude Zidi

Reinforcement Learning

to the Rescue

Reinforcement Learning

• Agent interagiert mit Umgebung

• Lernen und durch

Bestrafung/Belohnung

Source: Wikipedia/megajuice 22

Model selection & ImplementationBasic idea

23

nameQuery field:

true liesQuery entity:

authorResponse field:

Zhong, Socher (2017): Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learning

“Who was the writer of true lies?”

model

James Cameron, Claude Zidi

Model selection & ImplementationBasic idea

25

+25

nameQuery field:

true liesQuery entity:

authorResponse field:

“Who was the writer of true lies?”

model

James Cameron, Claude Zidi

Model selection & ImplementationBasic idea

26

-1

nameQuery field:

true liesQuery entity:

authorResponse field:

“Who was the writer of true lies?”

model

Thriller

Model selection & ImplementationBasic idea

27

-2

nameQuery field:

true liesQuery entity:

authorResponse field:

“Who was the writer of true lies?”

model

<error>

28

What movies did Temuera Morrison act in?

29

After 10 epochs

After 20 epochs

What movies did Temuera Morrison act in?

30

After 30 epochs

After 40 epochs

Perfromance-Vergleich MBs 256

31

Generalisierung

32

‣ State of the Art DL4NLP: Embed, Encode, Attend, Predict

‣ Es funktioniert!

‣ Erstaunlich gut auf dem relativ klar definierten Datensatz

‣ Mittels Reinforcement Learning können nicht-differenzierbare

Bruchstellen (z.b. noSQL) überbrückt werden.

Conclusion

33

Vielen Dank!Hans-Peter ZornData Management & AnalyticsHead of Machine Perception & AI

inovex GmbH

Ludwig-Erhard-Allee 6

76133 Karlsruhe

Mobil: +49 (0)173 3181 093

Mail: hzorn@inovex.de

Sie möchten individuelle Beratung? Nehmen SieKontakt mit uns auf!

info@inovex.de

Recommended