<jupyter_start><jupyter_text>What is Tensorflow?Currently, the most famous DeepLearning library in the world is Google's TensorFlow. Google product uses machine learning in all of its products to improve the search engine, translation, image captioning, or recommendations.Tensorflow architecture works in three parts:  1. Preprocessing the data  2. Build the model  3. Train and estimate the modelIt is called Tensorflow because it takes input as a multi-dimensional array which is also known as tensors.I am assuming that you know a little about the machine learning and deep learningWhy Every Data Scientist Learn Tensorflow 2.x not Tensorflow 1.xThere are many changes in TensorFlow 2.0 to make users more productive, including removing redundant APIs, making APIs more consistent (Unified RNNs, Unified Optimizers), and better integrating with the Python runtime with Eager execution:  1. API Cleanup  2. Eager execution  3. Functions, not sessions (session.run())<jupyter_code>import tensorflow as tf
import tensorflow_hub as hub
print("TF Version",tf.__version__)
print("TF Hub  Version",hub.__version__)
print("GPU Available, YESSS!!!")if tf.config.list_physical_devices("GPU") else "Not Available"<jupyter_output>GPU Available, YESSS!!!<jupyter_text>Import MNIST data<jupyter_code>from tensorflow import keras
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

mnist = keras.datasets.fashion_mnist
type(mnist)
(X_train,y_train),(X_test,y_test) = mnist.load_data()
X_train.shape,y_train.shape
X_test.shape,y_test.shape
X_train
np.max(X_train),np.min(X_train)
np.max(X_test),np.min(X_test)
y_train
class_names = ["top","trouser","pullover","dress","coat","sandal","shirt","sneaker","bag","ankle boot"]
plt.figure()
plt.imshow(X_train[0])
plt.colorbar();
X_train = X_train/255.0
X_test = X_test/255.0
plt.figure()
plt.imshow(X_train[0])
plt.colorbar();<jupyter_output><empty_output><jupyter_text>Build a model with TenserFlow 2.0<jupyter_code>from tensorflow.keras import Sequential
from tensorflow.keras.layers import Flatten,Dense
model = Sequential()
model.add(Flatten(input_shape=(28,28)))
model.add(Dense(128,activation='relu'))
model.add(Dense(10,activation='softmax'))
model.summary()
X_train.shape<jupyter_output><empty_output><jupyter_text>Model compilation:Neccesary things:  * Loss Function  * Optimizer  * Metrics<jupyter_code>model.compile(optimizer='adam',loss='sparse_categorical_crossentropy',metrics=['accuracy'])
model.fit(X_train,y_train,epochs=10)
X_train.shape,y_train.shape
test_loss,test_acc = model.evaluate(X_test,y_test)
print(test_acc)
print(test_loss)
from sklearn.metrics import accuracy_score
y_pred = model.predict_classes(X_test)
accuracy_score(y_pred,y_pred)
pred = model.predict(X_test)
pred
pred[0]
np.argmax(pred[0])
np.argmax(pred[1])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10572842998585573, 'fraction_numerical': 0.01272984441301273, 'mean_word_length': 7.704615384615384, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '374880', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 969, 'n_tokens_neox': 926, 'n_words': 243, 'path': 'mnist.ipynb', 'repo_name': 'aakashspeaks/SFrame', 'size': '2828'}