TensorFlow, Google द्वारा प्रदान किया गया एक मशीन लर्निंग फ्रेमवर्क है। यह एक ओपन-सोर्स फ्रेमवर्क है जिसका उपयोग Python के साथ एल्गोरिदम, डीप लर्निंग एप्लिकेशन, और बहुत कुछ लागू करने के लिए किया जाता है। इसका उपयोग अनुसंधान और उत्पादन उद्देश्यों के लिए किया जाता है। इसमें ऑप्टिमाइज़ेशन तकनीकें हैं जो जटिल गणितीय संचालन को तेजी से करने में मदद करती हैं क्योंकि यह NumPy और बहुआयामी सरणियों का उपयोग करता है। इन बहुआयामी सरणियों को 'टेंसर' के रूप में भी जाना जाता है। यह फ्रेमवर्क डीप न्यूरल नेटवर्क के साथ काम करने का समर्थन करता है।
इंस्टॉलेशन
Windows पर 'tensorflow' पैकेज को निम्न कमांड से इंस्टॉल किया जा सकता है:
pip install tensorflow
टेंसर
टेंसर TensorFlow में उपयोग की जाने वाली एक डेटा संरचना है। यह फ्लो डायग्राम में एज को जोड़ने में मदद करता है। इस फ्लो डायग्राम को 'डेटा फ्लो ग्राफ' के रूप में जाना जाता है। टेंसर एक बहुआयामी सरणी या सूची के अलावा कुछ नहीं हैं।
Iliad डेटासेट
हम Iliad डेटासेट का उपयोग करेंगे, जिसमें विलियम कूपर, एडवर्ड (डर्बी के अर्ल) और सैमुअल बटलर के तीन अनुवाद कार्यों का टेक्स्ट डेटा होता है। मॉडल को एक पंक्ति टेक्स्ट दिए जाने पर अनुवादक की पहचान करने के लिए प्रशिक्षित किया जाता है। उपयोग की गई टेक्स्ट फाइलें पूर्व-प्रसंस्कृत हैं।
Google Colaboratory
हम नीचे दिए गए कोड को चलाने के लिए Google Colaboratory का उपयोग कर रहे हैं। Google Colab ब्राउज़र पर Python कोड चलाने में मदद करता है और GPUs तक मुफ्त पहुंच प्रदान करता है।
कोड उदाहरण
print("Combine the labelled dataset and reshuffle it")
BUFFER_SIZE = 50000
BATCH_SIZE = 64
VALIDATION_SIZE = 5000
all_labeled_data = labeled_data_sets[0]
for labeled_dataset in labeled_data_sets[1:]:
all_labeled_data = all_labeled_data.concatenate(labeled_dataset)
all_labeled_data = all_labeled_data.shuffle(
BUFFER_SIZE, reshuffle_each_iteration=False)
print("Displaying a few samples of input data")
for text, label in all_labeled_data.take(8):
print("The sentence is : ", text.numpy())
print("The label is :", label.numpy())
कोड क्रेडिट: https://www.tensorflow.org/tutorials/load_data/text
आउटपुट
Combine the labelled dataset and reshuffle it Displaying a few samples of input data The sentence is : b'But I have now both tasted food, and given' The label is : 0 The sentence is : b'All these shall now be thine: but if the Gods' The label is : 1 The sentence is : b'Their spiry summits waved. There, unperceived' The label is : 0 The sentence is : b'"I pray you, would you show your love, dear friends,' The label is : 1 The sentence is : b'Entering beneath the clavicle the point' The label is : 0 The sentence is : b'But grief, his father lost, awaits him now,' The label is : 1 The sentence is : b'in the fore-arm where the sinews of the elbow are united, whereon he' The label is : 2 The sentence is : b'For, as I think, I have already chased' The label is : 0
व्याख्या
डेटा को पूर्व-प्रसंस्कृत करने के बाद, डेटासेट से कुछ नमूने कंसोल पर प्रदर्शित होते हैं।
डेटा समूहीकृत नहीं है, जिसका अर्थ है कि 'all_labeled_data' में प्रत्येक प्रविष्टि एक डेटा बिंदु से मैप होती है।