Machine translation परिचय

Keras के साथ Machine Translation

Thushan Ganegedara

Data Scientist and Author

Machine translation

Hello translations

Keras के साथ Machine Translation

Machine translation

Google आइकन के साथ Hello अनुवाद

Keras के साथ Machine Translation

कोर्स रूपरेखा

  • Chapter 1 - Machine translation परिचय
  • Chapter 2 - Machine translation मॉडल लागू करें (encoder-decoder architecture)
  • Chapter 3 - मॉडल को ट्रेन करें और अनुवाद जनरेट करें
  • Chapter 4 - अनुवाद मॉडल को बेहतर बनाएँ
Keras के साथ Machine Translation

डेटासेट (English-French वाक्य कॉर्पस)

  • English corpus
new jersey is sometimes quiet during autumn , and it is snowy in april .
the united states is usually chilly during july , and it is usually freezing ...
california is usually quiet during march , and it is usually hot in june .
  • French corpus
new jersey est parfois calme pendant l' automne , et il est neigeux en avril .
les états-unis est généralement froid en juillet , et il gèle habituellement ...
california est généralement calme en mars , et il est généralement chaud en juin .
1 https://github.com/udacity/deep-learning/tree/master/language-translation/data
Keras के साथ Machine Translation

Machine translation - Overview

English से French

Keras के साथ Machine Translation

Machine translation - Overview

स्रोत और लक्ष्य भाषा शब्द

Keras के साथ Machine Translation

Machine translation - Overview

Machine translation मॉडल

Keras के साथ Machine Translation

Machine translation - Overview

Machine translation मॉडल

Keras के साथ Machine Translation

One-hot encoded वेक्टर

  • 1 और 0 का एक वेक्टर
  • वेक्टर की लंबाई vocabulary के आकार से तय होती है
  • Vocabulary - डेटासेट के यूनिक शब्दों का संग्रह

One hot वेक्टर

Keras के साथ Machine Translation

One-hot encoded वेक्टर

शब्दों और उनके संबद्ध indices वाली एक mapping

word2index = {"I":0, "like": 1, "cats": 2}

शब्दों को IDs या indices में बदलना

words = ["I", "like", "cats"]
word_ids = [word2index[w] for w in words]
print(word_ids)
[0, 1, 2]
Keras के साथ Machine Translation

One-hot encoded वेक्टर

आउटपुट वेक्टर लंबाई बताए बिना one-hot encoding

onehot_1 = to_categorical(word_ids)
print([(w,ohe.tolist()) for w,ohe in zip(words, onehot_1)])
[('I', [1.0, 0.0, 0.0]), ('like', [0.0, 1.0, 0.0]), ('cats', [0.0, 0.0, 1.0])]

आउटपुट वेक्टर लंबाई बताकर one-hot encoding

onehot_2 = to_categorical(word_ids, num_classes=5)
print([(w,ohe.tolist()) for w,ohe in zip(words, onehot_2)])
[('I', [1.0, 0.0, 0.0, 0.0, 0.0]), ('like', [0.0, 1.0, 0.0, 0.0, 0.0]), 
('cats', [0.0, 0.0, 1.0, 0.0, 0.0])]
Keras के साथ Machine Translation

अभ्यास करते हैं!

Keras के साथ Machine Translation

Preparing Video For Download...