SlideShare a Scribd company logo
1 of 87
NEHRU INSTITUTE OF ENGINEERING AND TECHNOLOGY
(AUTONOMOUS)
Thirumalayampalayam, Coimbatore-641 105
(Approved by AICTE, New Delhi and Affiliated to Anna University, Chennai)
An ISO 9001:2015 and ISO 14001:2015 Certified Institution
Re-Accredited by NAAC with A+ and Recognized by UGC with Section 2(f) and 12(B)
NBA Accredited UG Programmes : AERO | CSE
T.M. Palayam, Coimbatore-641105
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CCS335 – Neural Network and Deep Learning Lab
SEMESTER - VI
REGULATION 2021
NAME : .……………………………………….
REG NO : ………………………………………..
DEPARTMENT : .……………………………………….
NEHRU INSTITUTE OF ENGINEERING AND TECHNOLOGY
(AUTONOMOUS)
Thirumalayampalayam, Coimbatore-641 105
(Approved by AICTE, New Delhi and Affiliated to Anna University,
Chennai) An ISO 9001:2015 and ISO 14001:2015 Certified Institution
Re-Accredited by NAAC with A+ and Recognized by UGC with Section 2(f)
and 12(B) NBA Accredited UG Programmes : AERO | CSE
T.M. Palayam, Coimbatore-641105
Certified that this is a bonafide record of work done in CCS335 Neural Networks and Deep Learning Lab
by Mr. /Ms.
Reg.No of this Institution as prescribed by Anna University, Chennai
For the VI Semester course in Computer Science and Engineering branch during the academic year 2023-
2024.
Staff In charge:
Date : HOD
Submitted for the university practical examination held on at Nehru Institute of
Engineering and Technology, Coimbatore – 641105.
……………………………………. …………………………………….
Internal Examiner External Examiner
CCS33 NEURAL NETWORK AND DEEP LEARNING LABORATORY L T P C
3 0 2 4
OBJECTIVES:
The main objectives of this course are to:
 To understand the basic in deep neural networks
 To understand the basic of associative memory and unsupervised learning network.
 To apply CNN architecture of deep neural networks.
 To analyze the key computations underling deep learning, then use them to build and train deep neural
networks for various tasks.
 To apply auto encoders and generative models for suitable applications.
LIST OF EXPERIMENTS:
1. Implement simple vector addition in Tensor Flow.
2. Implement a regression model in Keras.
3. Implement a perception in TensorFlow/Keras Environment.
4. Implement a Feed Forward Network in TensorFlow/Keras.
5. Implement an image classifier using CNN in TensorFlow/Keras.
6. Improve the deep Learning model by fine tuning hyper parameters.
7. Implement a Transfer Learning concept in image classification.
8. Using a pre trained model on Keras for transfer learning.
9. Perform Sentimental Analysis using RNN.
10. Implement an LSTM based Auto encoding inTensorflow/Keras.
11. Image generation using GAN.
ADDITIONAL EXPERIMENTS
12. Train a deep Learning model to classify a given image using pre trained model.
13. Recommendation system from sales data using Deep Learning.
14. Implement Object detection using CNN.
15. Implement any simple Reinforcement Algorithm for an NLP problem.
TOTAL: 60 PERIODS
OUTCOMES:
After the Completion of the course, the students will be able to:
 Apply Convolution Neural Network for image processing.
 Understand the basics of associative memory and unsupervised learning networks.
 Apply CNN and its variants for suitable applications.
 Analyze the key computations underlying deep learning and use them to build and train deep neural
networks for various tasks.
 Apply auto encoders and generative models for suitable applications.
SOFTWARE REQUIRED:
● Jupiter Notebook, Colab.
LIST OF EXPERIMENTS
EX.NO. DATE NAME OF THE EXPERIMENT
PAGE
NO. SIGNATURE
1.
Implement simple vector addition in Tensor
Flow.
2. Implement a regression model in Keras.
3.
Implement a perception in TensorFlow/Keras
Environment.
4.
Implement a Feed Forward Network in
TensorFlow/Keras.
5.
Implement an image classifier using CNN in
TensorFlow/Keras.
6.
Improve the deep Learning model by fine
tuning hyper parameters.
7.
Implement a Transfer Learning concept in
image classification.
8.
Using a pre trained model on Keras for
transfer learning.
9. Perform Sentimental Analysis using RNN.
10.
Implement an LSTM based Auto encoding
inTensorflow/Keras.
11. Image generation using GAN.
12.
Train a deep Learning model to classify a
given image using pre trained model.
13.
Recommendation system from sales data
using Deep Learning.
14. Implement Object detection using CNN.
15.
Implement any simple Reinforcement
Algorithm for an NLP problem.
EXP.NO:0 DATE:
BASIC OF TENSERFLOW
Aim: To study the basic of tensor flow along python programs using Colab laboratory.
Questions:
i. Architecture of tensor flow
ii. How to convert Numpy array to tensor flow
iii. Matrix using tensor flow
Description:
i. Architecture of Tensor Flow
 TensorFlow is an end-to-end open-source machine learning platform developed by Google.
 It is scalable and flexible, running on various devices like data centers and mobile phones.
 Computation in TensorFlow is represented by a directed graph with nodes as
operations/functions and edges as input/output flows.
 Tensors, multi-dimensional arrays, serve as inputs and outputs in TensorFlow.
 The architecture includes device and network layers, kernel implementations, distributed
components, and API layers in C.
 Advanced features include custom operations, custom gradients, TensorFlow Eager
Execution, TensorFlow Keras, TensorFlow Probability, and TensorFlow Model
Optimization.
 TensorFlow is widely used for image classification, natural language processing, time-series
analysis, generative models, reinforcement learning, and anomaly detection.
ii. Convert Numpy array to tensor flow
The syntax for converting numpy array to tensor flow is :
tf.convert_to_tensor(value, dtype=None, dtype_hint=None, name=None)
 value: The input object to be converted into a tensor. It can be a NumPy array, Python list,
scalar value, etc. This parameter is mandatory.
 dtype: (Optional) The data type of the elements in the resulting tensor. If not specified, the data
type is inferred from the type of the value. It allows to explicitly set the data type for the tensor.
 dtype_hint: (Optional) When dtype is None, dtype_hint is an optional preferred data type for the
resulting tensor. It serves as a hint to TensorFlow about the preferred data type but has no effect
if the conversion is not possible. This parameter is useful when you want to suggest a preferred
data type without enforcing it.
 name: (Optional) An optional name for the resulting tensor. If a new tensor is produced during
the conversion, this name can be used to identify it in the TensorFlow graph.
The tf.convert_to_tensor() function is widely employed to transform various types of objects, including
NumPy arrays, into TensorFlow tensors. The resulting tensor can then be seamlessly integrated into
TensorFlow operations and workflows.
iii. Matrix using Tensorflow
The syntax for creating a matrix using TensorFlow's `tf.constant()` is :
tf.constant(value, dtype=None, shape=None, name='Const', verify_shape=False)
 value: The values to be used for initializing the constant tensor. In the context of creating a
matrix, this would be a nested list representing the matrix elements.
 dtype: (Optional) The data type of the elements in the tensor. If not specified, the data type is
inferred from the type of the `value`.
 shape: (Optional) The shape of the tensor. For creating a matrix, you can specify the shape as a
tuple representing the number of rows and columns.
 name: (Optional) An optional name for the operation.
 verify_shape: (Optional) A boolean that controls whether to check if the shape of the provided
value matches the specified shape argument. If set to `True` and the shapes do not match, a
`ValueError` will be raised.
Program:
i.Tensor Flow:
Output:
tf.Tensor(
[[1 2]
[3 4]], shape=(2, 2), dtype=int64)
ii.Convert Numpy array to tensor flow:
Output:
<tf.Variable 'tensor1:0' shape=(2, 2) dtype=float32, numpy=
array([[1., 2.],
[3., 4.]], dtype=float32)>
iii.Matrix using Tensorflow:
import tensorflow as tf
import numpy as np
numpy_array = np.array([[1,2],[3,4]])
tensor1 = tf.convert_to_tensor(numpy_array)
print(tensor1)
import tensorflow as tf
import numpy as np
numpy_array = np.array([[1, 2], [3, 4]])
tensor1 = tf.Variable(numpy_array, dtype=float, name='tensor1')
tensor1
import tensorflow as tf
matrix_data = [[1, 2, 3],
[4, 5, 6]]
matrix_tensor = tf.constant(matrix_data, dtype=tf.int32, shape=(2, 3),
name='MyMatrix')
print("TensorFlow Matrix:")
print(matrix_tensor)
Output:
TensorFlow Matrix:
tf.Tensor(
[[1 2 3]
[4 5 6]], shape=(2, 3), dtype=int32)
Result:
Thus the python program using tensor flow for above experiment is successfully executed and
verified.
EXP.NO:1 DATE:
Aim: To Implement simple vector addition in Tensor Flow using Colab laboratory.
Questions:
1. Scalar
2. Checking the dimensions of scalar
3. Vector
4. Checking the dimensions of vector
5. Matrix
6. Mathematical Operation
i. Addition
ii. Subtraction
iii. Multiplication
iv. Division
v. Transpose
vi. Dot Product
Algorithm:
1. Start Colab:
a. Open Google Colab in your web browser.
b. Create a new notebook.
2. Scalar:
a. Import TensorFlow.
b. Define a scalar using `tf.constant()`.
3. Checking the Dimensions of Scalar:
a. Use `scalar.ndim` to find dimension of scalar.
4. Vector:
a. Define a vector using `tf.constant()` with a 1D array.
5. Checking the Dimensions of Vector:
a. Use `vector.ndim` to find dimension of vector.
6. Matrix:
a. Define a matrix using `tf.constant()` with a 2D array.
7. Mathematical Operations:
i. Addition:
a. Use `tf.add()` for element-wise addition.
ii. Subtraction:
a. Use `tf.subtract()` for element-wise subtraction.
iii. Multiplication:
a. Use `tf.multiply()` for element-wise multiplication.
iv. Division:
a. Use `tf.divide()` for element-wise division.
v. Transpose:
a. Use `tf.transpose()` for matrix transposition.
vi. Dot Product:
a. Use `tf.tensordot()` for matrix multiplication.
8. Run the Code:
a. Execute each cell in the Colab notebook to see the results.
Program:
1.Scalar:
Output:
<tf.Tensor: shape=(), dtype=int32, numpy=7>
2.Dimensions of Scalar:
Output:
0
3.Vector:
# importing packages
import tensorflow as tf
# creating a scalar
scalar = tf.constant(7)
scalar
#checking dimensions of scalar
scalar.ndim
# importing
packages import
tensorflow as tf
# create a vector
vector = tf.constant([10,
10]) vector
Output:
<tf.Tensor: shape=(2,), dtype=int32, numpy=array([10, 10], dtype=int32)>
4.Dimensions of Vector:
Output:
1
5.Matrix:
Output:
tf.Tensor(
[[1 2]
[3 4]], shape=(2, 2), dtype=int32)
The number of dimensions of a matrix is :2
6.Mathematical Operations:
i.Addition:
Output:
tf.Tensor(
[[ 3 6]
[ 9 12]], shape=(2, 2), dtype=int32)
# importing packages
import tensorflow as tf
# creating two tensors
matrix = tf.constant([[1, 2], [3, 4]])
matrix1 = tf.constant([[2, 4], [6, 8]])
# addition of two matrices
result = tf.add(matrix, matrix1)
print(result)
# checking the dimensions of vector
vector.ndim
# importing packages
import tensorflow as tf
# creating a matrix
matrix = tf.constant([[1, 2], [3, 4]])
print(matrix)
print('the number of dimensions of a matrix is :
'+str(matrix.ndim))
ii.Subtraction:
Output:
tf.Tensor(
[[1 2]
[3 4]], shape=(2, 2), dtype=int32)
ii.Multiplication:
Output:
tf.Tensor(
[[ 2 8]
[18 32]], shape=(2, 2), dtype=int32)
[15 22]], shape=(2, 2), dtype=int32
# importing packages
import tensorflow as tf
# creating two tensors
matrix = tf.constant([[1, 2], [3, 4]])
matrix1 = tf.constant([[2, 4], [6, 8]])
# multiplication of two matrices
result=tf.multiply(matrix,matrix1)
print(result)
# importing packages
import tensorflow as tf
# creating two tensors
matrix = tf.constant([[1, 2], [3, 4]])
matrix1 = tf.constant([[2, 4], [6, 8]])
# subtraction of two matrices
result=tf.subtract(matrix,matrix1)
print(result)
iii.Division:
Output:
tf.Tensor(
[[2. 2.]
[2. 2.]], shape=(2, 2), dtype=float64)
iv. Transpose:
Output:
tf.Tensor(
[[1 3]
[2 4]], shape=(2, 2), dtype=int32)
# importing packages
import tensorflow as tf
# creating two tensors
matrix = tf.constant([[1, 2],[3, 4]])
matrix1 = tf.constant([[2, 4],[6, 8]])
# division of two matrices
result=tf.divide(matrix,matrix1)
print(result)
# importing packages
import tensorflow as tf
# creating a matrix
matrix = tf.constant([[1, 2], [3, 4]])
# transpose of the matrix
print(tf.transpose(matrix))
v. Dot Product:
Output:
dot product of matrices is : tf.Tensor(
[[ 7 10]
Result:
Thus the python program using tensor flow for about mathematical operations is successfully
executed and verified.
# importing packages
import tensorflow as tf
# creating a matrix
matrix = tf.constant([[1, 2], [3, 4]])
# dot product of matrices
print('dot product of matrices is : ' +
str(tf.tensordot(matrix, matrix, axes=1)))
EXP.NO:2 DATE:
Aim: To Implement a regression model in Keras using mnist -dataset in Colab laboratory.
Dataset Details:
Mnist Dataset: https://www.kaggle.com/datasets/oddrationale/mnist-in-csv
Objective:
Step 1 - Import the library
Step 2 - Loading the Dataset
Step 3 - Creating Regression Model
Step 4 - Compiling the model
Step 5 - Fitting the model
Step 6 - Evaluating the model
Step 7 - Predicting the output
Description:
1.Import The Libraries:
 Import necessary libraries: Pandas, Numpy, Keras, Scikit-learn, etc., .
2.Upload The Dataset:
 Upload the dataset in drive using mount drive method.
3.Load The Dataset:
 Load the mnist_train and mnsit_test datasets.
4.Data Preprocessing:
 Change the pixels od the dataset to perform further actions.
5.Creating Regression Model:
 Create a sequential model with two args.
 Add linear stack of layers and use activation function ‘relu’.
6.Compiling the Model:
 Compile the model with the Adam optimizer, mean squared error as the loss function,
and mean absolute error as the evaluation metric.
7.Fitting the Model:
 Split the dataset into training and testing sets using scikit-learn.
 Standardize the input features using the StandardScaler from scikit-learn.
 Use training data for fitting the model and use paramaters like epochs, batch_size,
verbose, etc., .
8.Evaulating The Model:
 Use model.evaluate to evaluate the model and it will give us the loss and the accuracy.
 Here we have also printed the score.
9.Predicting The Output:
 Use another part of the data that we get from test_train_split i.e. test data.
 We will use it and predict the output.
Program:
1.Import The Library:
2.Upload The Dataset:
drive.mount('/content/drive')
Output:
Mounted at /content/drive
import pandas as pd
import numpy as np
from keras.datasets import mnist
from sklearn.model_selection import train_test_split
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from google.colab import drive
3.Load The Dataset:
4.Data Preprocessing:
X_train = X_train.astype('float32') / 255
X_test = X_test.astype('float32') / 255
y_train = y_train.astype('float32') / 255
y_test = y_test.astype('float32') / 255
5.Creating Regression Model:
6.Compiling The Model:
7.Fitting The Model:
mnist_train = pd.read_csv("/content/drive/MyDrive/mnist_test.csv")
mnist_test = pd.read_csv("/content/drive/MyDrive/mnist_train.csv")
X_train = mnist_train.drop("label", axis=1).values
y_train = mnist_train["label"].values
X_test = mnist_test.drop("label", axis=1).values
y_test = mnist_test["label"].values
model = Sequential()
model.add(Dense(512, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(256, activation='relu'))
model.add(Dropout(0.25))
model.add(Dense(10))
model.compile(loss='sparse_categorical_crossentropy',
optimizer='adam',
metrics=['accuracy'])
model.fit(X_train, y_train,
batch_size=128,
epochs=2,
verbose=1,
validation_data=(X_test, y_test))
model.summary()
Output:
Epoch 1/2
79/79 [==============================] - 9s 98ms/step - loss: 0.1766 - accuracy:
0.0957 - val_loss: 9.5367e-07 - val_accuracy: 0.0987
Epoch 2/2
79/79 [==============================] - 9s 109ms/step - loss: 9.5367e-07 - accuracy:
0.0980 - val_loss: 9.5367e-07 - val_accuracy: 0.0987
Model: "sequential_3"
Layer (type) Output Shape Param #
=================================================================
dense_6 (Dense) (None, 512) 401920
dropout_4 (Dropout) (None, 512) 0
dense_7 (Dense) (None, 256) 131328
dropout_5 (Dropout) (None, 256) 0
dense_8 (Dense) (None, 10) 2570
=================================================================
Total params: 535818 (2.04 MB)
Trainable params: 535818 (2.04 MB)
Non-trainable params: 0 (0.00 Byte)
8.Evaluating the Model:
Output:
Test loss: 9.536742595628311e-07
Test accuracy: 0.09871666878461838
score = model.evaluate(X_test, y_test, verbose=0)
print('Test loss:', score[0])
print('Test accuracy:', score[1])
9.Predicting the Output:
Output:
1875/1875 [==============================] - 10s 5ms/step
[[ 7.6505547 -5.039996 -4.8032265 ... -5.1202197 -4.11554 -4.5914993]
[ 8.687883 -5.6656256 -5.358442 ... -5.6097336 -4.4189353 -4.6995463]
[ 5.088747 -3.361604 -3.19289 ... -3.178188 -2.7151685 -2.9893024]
...
[ 6.4936686 -4.0753646 -3.68436 ... -4.2753725 -3.3604608 -3.5153835]
[ 5.344781 -3.5582738 -3.5012681 ... -3.5117133 -2.885717 -3.028985 ]
[ 5.977292 -3.7096646 -3.6107407 ... -3.9403937 -3.1786413 -3.3968258]]
Result:
Thus the python program using tensor flow for Regression in Keras is successfully executed and
verified.
y_pred = model.predict(X_test)
print(y_pred)
EXP.NO:3 DATE:
Aim: To Implement a Perceptron using Keras/ Tensor flow environment.
Project Details:
https://www.geeksforgeeks.org/multi-layer-perceptron-learning-in-tensorflow/
https://www.geeksforgeeks.org/single-layer-perceptron-in-tensorflow/
Objective:
Step1: Import necessary libraries
Step 2: Now load the dataset using “Keras” from the imported version of tensor flow.
Step 3: Now display the shape and image of the single image in the dataset. The image size contains
a 28*28 matrix and length of the training set is 60,000 and the testing set is 10,000.
Step 4: Now normalize the dataset in order to compute the calculations in a fast and accurate
manner.
Step 5: Building a neural network with single-layer perception. Here we can observe as the model
is a single-layer Perceptron that only contains one input layer and one output layer there is
no presence of the hidden layers.
Step 6: Output the accuracy of the model on the testing data.
Description:
1.Import the Libraries:
 Essential libraries are imported including TensorFlow and Keras for building and training neural
networks, Numpy for numerical operations, and Matplotlib for visualization.
2.Upload the Dataset:
 Dataset is uploaded in drive using mount drive method.
3.Load the Dataset:
 The MNIST dataset, consisting of 60,000 training images and 10,000 testing images of
handwritten digits (0-9), is loaded.
4.Displaying Dataset:
 Information about the dataset is printed, including the shapes of training and testing data.
 Additionally, the first image from the training set is displayed for visualization.
5.Normalizing the Dataset:
 The pixel values of the images are normalized to a range between 0 and 1 by dividing
each pixel value by 255.0.
 This standardizes the data and helps in faster convergence during training.
6.Flattening the Image:
 The input images are flattened from a 28x28 matrix to a 1D array of length 784 to match
the input shape expected by the model.
7.Building the Model:
 Building a neural network with single-layer perception.
 Here we can observe as the model is a single-layer perceptron that only contains one
input layer and one output layer there is no presence of the hidden layers.
8.Output Accuracy:
 The model's accuracy is evaluated on the testing data using the evaluate () method.
 The accuracy is then printed out as a percentage, indicating how well the model
generalizes to unseen data.
Program:
1.Import The Libraries:
2.Upload The Dataset:
drive.mount('/content/drive')
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow import keras
import matplotlib.pyplot as plt
%matplotlib inline
from google.colab import drive
import matplotlib.pyplot as plt
3.Load The Dataset:
4.Displaying The Dataset:
Output:
Training data shape: (10000, 784)
Testing data shape: (60000, 784)
Shape of the first image: (784,)
<matplotlib.image.AxesImage at 0x796ebbf83d60>
mnist_train = pd.read_csv("/content/drive/MyDrive/mnist_test.csv")
mnist_test = pd.read_csv("/content/drive/MyDrive/mnist_train.csv")
x_train = mnist_train.drop("label", axis=1).values
y_train = mnist_train["label"].values
x_test = mnist_test.drop("label", axis=1).values
y_test = mnist_test["label"].values
print("Training data shape:", x_train.shape)
print("Testing data shape:", x_test.shape)
print("Shape of the first image:", x_train[0].shape)
# Reshape the flattened image into a 2D array and display first image
image = np.reshape(x_train[0], (28, 28))
plt.imshow(image)
5.Normalizing The Dataset:
x_train = x_train.astype('float32') / 255
x_test = x_test.astype('float32') / 255
y_train = y_train.astype('float32') / 255
y_test = y_test.astype('float32') / 255
6.Flatenning The Image:
1. Building The Model:
Output:
Epoch 1/5
313/313 [==============================] - 1s 1ms/step - loss: 0.0888 - accuracy:
0.0975
Epoch 2/5
313/313 [==============================] - 0s 1ms/step - loss: 0.0051 - accuracy:
0.0980
Epoch 3/5
313/313 [==============================] - 0s 1ms/step - loss: 0.0024 - accuracy:
0.0980
Epoch 4/5
313/313 [==============================] - 0s 1ms/step - loss: 0.0015 - accuracy:
0.0980
Epoch 5/5
313/313 [==============================] - 0s 1ms/step - loss: 9.8897e-04 - accuracy:
0.0980
<keras.src.callbacks.History at 0x796ebbe53a30>
x_train_flatten = x_train.reshape(len(x_train), 28*28)
x_test_flatten = x_test.reshape(len(x_test), 28*28)
model = keras.Sequential([
keras.layers.Dense(10, input_shape=(784,),
activation='sigmoid')
])
model.compile(
optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.fit(x_train_flatten, y_train, epochs=5)
2. Output Accuracy:
Output:
1875/1875 [==============================] - 3s 2ms/step - loss: 8.6323e-04 -
accuracy: 0.0987
Accuracy: 9.87%
Result:
Thus the python program using tensor flow for Regression in Keras is successfully executed and
verified.
evaluation_results = model.evaluate(x_test_flatten, y_test)
accuracy = evaluation_results[1]
# Convert accuracy to percentage
accuracy_percentage = accuracy * 100
# Print accuracy
print("Accuracy: {:.2f}%".format(accuracy_percentage))
EXP.NO:4 DATE:
Aim: To Implement a Feed Forward network using Keras/ Tensor flow environment.
Project Details:
https://www.analyticsvidhya.com/blog/2016/10/an-introduction-to-implementing-neural-networks-using-
tensorflow/
Objective:
A typical implementation of Neural Network would be as follows:
Step 1: Define Neural Network architecture to be compiled.
Step 2: Transfer data to your model.
Step 3: Under the hood, the data is first divided into batches, so that it can be ingested. The
batches are first preprocessed, augmented and then fed into Neural Network for
training
Step 4: The model then gets trained incrementally.
Step 5: Display the accuracy for a specific number of time steps.
Step 6: After training save the model for future use.
Step 7: Test the model on a new data and check how it performs
Program:
i. Implementing Scikit-learn
The usual workflow of running a program in TensorFlow is as follows:
 Build a computational graph, this can be any mathematical operation TensorFlow supports.
 Initialize variables, to compile the variables defined previously
 Create session, this is where the magic starts!
 Run graph in session, the compiled graph is passed to the session, which starts its
execution. Close session, shutdown the session.
Few terminologies used in TensorFlow;
 placeholder: A way to feed data into the graphs
 feed_dict: A dictionary to pass numeric values to computational graph
 Step 1: Define Neural Network architecture to be compiled.
We can control our models randomness
Set Directory Paths
 Step 2: Transfer data to your model.
Output:
 Step 3: Under the hood, the data is first divided into batches, so that it can be ingested. The batches
are first preprocessed, augmented and then fed into Neural Network for training.
Output:
 Step 4: The model then gets trained incrementally.
 Step 5: Display the accuracy for a specific number of time steps.
Output:
 Step 6: After training save the model for future use.
Output:
 Step 7: Test the model on a new data and check how it performs
Output:
Result:
Thus the python program using tensor flow for Regression in Keras is successfully executed and
verified.
EXP.NO:5 DATE:
Aim: To Implement an Image classifier using CNN in Keras/ Tensor flow environment.
Project Details:
https://www.tensorflow.org/tutorials/images/cnn
Objective:
Step 1: Import TensorFlow.
Step 2: Download and prepare the CIFAR10 dataset.
Step 3: Verify the data.
Step 4: Create the convolutional base.
Step 5: Add dense layers on top.
Step 6: Compile and train the model.
Step 7: Evaluate the model.
Program:
Step 1: Import TensorFlow.
Output:
Step 2: Download and prepare the CIFAR10 dataset.
The CIFAR10 dataset contains 60,000 color images in 10 classes, with 6,000 images in each class.
The dataset is divided into 50,000 training images and 10,000 testing images. The classes are mutually
exclusive and there is no overlap between them.
Output:
Step 3: Verify the data.
To verify that the dataset looks correct, let's plot the first 25 images from the training set and display the
class name below each image:
Output:
Step 4: Create the convolutional base.
The 6 lines of code below define the convolutional base using a common pattern: a stack
of Conv2D and MaxPooling2D layers. As input, a CNN takes tensors of shape (image height, image
width, color channels), ignoring the batch size. If you are new to these dimensions, color channels
refers to (R, G, and B). In this example, you will configure your CNN to process inputs of shape (32,
32, 3), which is the format of CIFAR images. You can do this by passing the argument input shape to
your first layer.
Output:
Step 5: Add dense layers on top.
To complete the model, you will feed the last output tensor from the convolutional base (of
shape (4, 4, and 64)) into one or more Dense layers to perform classification. Dense layers
take vectors as input (which are 1D), while the current output is a 3D tensor. First, you will
flatten (or unroll) the 3D output to 1D, then add one or more Dense layers on top. CIFAR has
10 output classes, so you use a final dense layer with 10 outputs.
Output:
Step 6: Compile and train the model.
Output:
Step 7: Evaluate the model.
Output:
Result:
Thus the python program using tensor flow for Regression in Keras is successfully executed
and verified.
EXP.NO:6 DATE:
Aim: To Implement a Deep learning model by fine turning parameters.
Project Details:
https://pyimagesearch.com/2019/06/03/fine-tuning-with-keras-and-deep-learning/
https://www.analyticsvidhya.com/blog/2021/05/tuning-the-hyperparameters-and-layers-of-neural-
network-deep-learning/
Objective:
Step 1: Imports useful packages for Neural Network modeling.
Step 2: Makes accuracy the scorer metric.
Step 3: Load Dataset
Step 4: Function will return returns the score of the cross-validation.
Step 5: Sets the range of hyper parameters and run the Bayesian Optimization.
Step 6: Best hyper parameters.
Step 7: Creates a function for tuning the Neural Network hyper parameters and layers.
Step 8: Tuned hyper parameters and layers.
Step 9: Fitting Neural Network.
Program:
Step 1: Imports useful packages for Neural Network modeling.
Step 2: Makes accuracy the scorer metric.
Step 3: Load Dataset
Step 4: Function will return returns the score of the cross-validation.
Step 5: Sets the range of hyper parameters and run the Bayesian Optimization.
Output:
Step 6: Best hyper parameters.
Output:
Step 7: Creates a function for tuning the Neural Network hyper parameters and layers.
Output:
Step 8: Tuned hyper parameters and layers.
Output:
Step 9: Fitting Neural Network.
Output:
Result:
Thus the python program using tensor flow for Regression in Keras is successfully executed and
verified.
EXP.NO:7 DATE:
Aim: To Implement a Transfer learning concept in image Classification.
Project Details:
https://www.geeksforgeeks.org/multiclass-image-classification-using-transfer-learning/
https://www.analyticsvidhya.com/blog/2021/10/understanding-transfer-learning-for-deep-
learning/
Objective:
Step 1: Importing Libraries
Step 2: Uploading Data via Kaggle API
Step 3: Designing Our CNN Model with help of Pre–Trained Model
Step 4: Image Augmentation (For preventing the issue of over fitting)
Step 5: Training Our Model.
Step 6: Making Predictions.
Program:
Step 1: Importing Libraries.
Step 2: Uploading Data via Kaggle API
Step 3: Designing Our CNN Model with help of Pre–Trained Model.
Step 4: Image Augmentation (For preventing the issue of over fitting).
Step 5: Training Our Model.
Step 6: Making Predictions.
Output:
Result:
Thus the python program using tensor flow for Regression in Keras is successfully executed
and verified.
EXP.NO:8 DATE:
Aim: To Implement a Pretrained model for Keras for transfer learning.
Project Details:
https://www.geeksforgeeks.org/multiclass-image-classification-using-transfer-learning/
https://www.analyticsvidhya.com/blog/2017/06/transfer-learning-the-art-of-fine-tuning-a-pre-trained-
model/.
Objective:
Step 1: Retrain the output dense layers only.
Step 2: Freeze the weights of first few layers.
Program:
Step 1: Retrain the output dense layers only.
Step 2: Freeze the weights of first few layers.
Output:
Output:
Result:
Thus the python program using tensor flow for Regression in Keras is successfully executed and
verified.
EXP.NO:9 DATE:
Aim: To perform Sentimental Analysis using RNN.
Project Details:
https://towardsdatascience.com/a-beginners-guide-on-sentiment-analysis-with-rnn-9e100627c02e.
https://www.kaggle.com/code/rahulagg/sentiment-analysis-using-rnn.
Objective:
Step 1: Importing Libraries and Dataset
Step 2: load in training and test data.
Step 3: Loaded dataset with 25000 training samples, 25000 test samples.
Step 4: Pad sequences.
Step 5: Design an RNN model for sentiment analysis.
Step 6: Train and evaluate our model.
Program:
Step 1: Importing Libraries and Dataset.
The data: We will use Recurrent Neural Networks, and in particular LSTMs, to perform sentiment
analysis in Keras. Conveniently, Keras has a built-in IMDb movie reviews data set that we can use.
Step 2: load in training and test data.
Step 3: Loaded dataset with 25000 training samples, 25000 test samples.
Output:
That the review is stored as a sequence of integers. These are word IDs that have been pre-assigned to
individual words, and the label is an integer (0 for negative, 1 for positive).
Output:
Maximum review length and minimum review length.
Maximum review length: 2697
Minimum review length: 14
Step 4: Pad sequences.
Step 5: Design an RNN model for sentiment analysis.
Output:
Step 6: Train and evaluate our model.
Output:
Result:
Thus the python program using tensor flow for Sentimental Analysis using RNN is successfully
executed and verified.
EXP.NO:10 DATE:
Aim: To Implement an LSTM based Auto encoding inTensorflow/Keras.
Project Details:
https://analyticsindiamag.com/introduction-to-lstm-autoencoder-using-
keras/#:~:text=LSTM%20autoencoder%20is%20an%20encoder,original%20structure%20using
%20a%20decoder.&text=Simple%20Neural%20Network%20is%20feed,ventures%20just%20in
%20one%20direction.
Objective:
Step 1: Import libraries required for this project
Step 2: Read the data
Step 3: Split the data
Step 4: Pre-Processing of Data
Step 5: Create a sequence with historical data
Step 6: Creating an LSTM Auto encoder Network
Step 7: Fitting the Model
Step 8: Evaluation
Step 9: Actual Value of Test Data
Step 10: Prediction on Test Data.
Program:
Step 1: Import libraries required for this project.
Step 2: Read the data.
Step 3: Split the data.
Step 4: Pre-Processing of Data.
Step 5: Create a sequence with historical data.
Step 6: Creating an LSTM Auto encoder Network
Step 7: Fitting the Model.
Step 8: Evaluation.
Step 9: Actual Value of Test Data.
Step 10: Prediction on Test Data.
Result:
Thus the python program using LSTM based Auto encoding in Keras is successfully executed and
verified.
EXP.NO: 11 DATE:
Aim: To Implement an Image generation using GAN.
Project Details:
https://www.scaler.com/topics/deep-learning/gans-image-generation/
https://www.analyticsvidhya.com/blog/2021/03/why-are-generative-adversarial-networksgans-so-
famous-and-how-will-gans-be-in-the-future/.
Objective:
Step 1: Reading the Dataset
Step 2: Defining the Generator.
Step 3: Defining the Discriminator.
Step 4: Computing the Loss Function
Step 5: Optimizing the Loss
Step 6: Generating Handwritten Digits.
Requirements
Before creating the GAN's image generation module, we must import a few libraries.
 We will import all the functions, layers, and dataset loaders from TensorFlow.
 We will also import Numpy (a math library) and matplotlib (a plotting library).
Building the Model
The GAN we want to create comprises two major parts:
 Generator
 Discriminator.
The Generator is responsible for creating novel images, while the Discriminator is responsible for
understanding how good the generated image is.
Program:
Step 1: Reading the Dataset.
The MNIST (Modified National Institute of Standards and Technology) dataset. This dataset has more
handwritten digits of 28x28 and is one of computer vision's most widely used datasets. The MNIST is
an easy dataset for a GAN such as the one we are building, as it has small, single channels images.
Step 2: Defining the Generator
The job of the Generator (D) is to create realistic images that the Discriminator fails to understand are
fake. Thus, the Generator is an essential component that enables a GANs image generation ability.
The architecture we consider in this article comprises fully connected layers (FC) and Leaky ReLU
activations. The final layer of the Generator has a TanH activation rather than a LeakyReLU. This
replacement was done because we wanted to convert the generated image to the same range as the
original MNIST dataset (-1, 1).
Step 3: Defining the Discriminator.
Step 4: Computing the Loss Function.
Step 5: Optimizing the Loss.
Step 6: Generating Handwritten Digits.
We trained the GAN for around 10,000 epochs with a batch size of 32. We save the generated images
every 200 epochs in the images folder.
Output:
Result:
Thus the python program using Image generation using GAN in Keras is successfully executed
and verified.
ADDITIONAL EXPERIMENTS
EXP.NO:12 DATE:
Aim: To implement a train a deep Learning model to classify a given image using pre trained model.
Project Details:
https://learnopencv.com/pytorch-for-beginners-image-classification-using-pre-trained-models/.
https://www.analyticsvidhya.com/blog/2017/06/transfer-learning-the-art-of-fine-tuning-a-pre-trained-
model/
Objective:
Step 1: Reading the input image.
Step 2: Performing transformations on the image. For example – resize, center crop, normalization, etc.
Step 3: Forward Pass: Use the pre-trained weights to find out the output vector. Each element in this
output vector describes the confidence with which the model predicts the input image belongs to a
particular class.
Step 4: Based on the scores obtained (elements of the output vector mentioned in step 3), display the
predictions.
Step 5: Load the pre-trained model
Step 6: Specify image transformations
Step 7: Load the input image and pre-process it
Step 8: Model Inference
Program:
Step 1: Reading the input image.
Step 2: Performing transformations on the image. For example – resize, center crop, normalization, etc.
Step 3: Forward Pass: Use the pre-trained weights to find out the output vector. Each element in this
output vector describes the confidence with which the model predicts the input image belongs to a
particular class.
Step 4: Based on the scores obtained (elements of the output vector mentioned in step 3), display the
predictions.
Step 5: Load the pre-trained model.
Step 6: Specify image transformations.
Step 7: Load the input image and pre-process it.
Output:
Step 8: Model Inference.
Output:
Result:
Thus the python program using a deep learning model to classify a given image using pre trained
model in Keras is successfully executed and verified.
EXP.NO:13 DATE:
Aim: To Implement a recommendation system from sales data using Deep Learning.
Project Details:
https://www.javatpoint.com/sales-prediction-using-machine-learning.
https://www.analyticsvidhya.com/blog/2020/08/building-sales-prediction-web-application-using-
machine-learning-dataset/
Objective:
Step 1: Importing Libraries.
Step 2: Loading and Exploration of the Data.
Step 3: EDA (Exploratory Data Analysis).
Step 4: Determining Time Series Stationary.
Step 5: Differencing.
Program:
Step 1: Importing Libraries.
Step 2: Loading and Exploration of the Data.
Output:
Step 3: EDA (Exploratory Data Analysis).
Output:
Output:
Step 4: Determining Time Series Stationary.
Output:
Step 5: Differencing.
Output:
Result:
Thus the python program using a recommendation system from sales data using Deep Learning is
successfully executed and verified.
EXP.NO:14 DATE:
Aim: To Implement object detection using CNN.
Project Details:
https://www.kaggle.com/code/silviua/object-detection-cnn
https://www.analyticsvidhya.com/blog/2018/11/implementation-faster-r-cnn-python-object-detection/
Objective:
Step 1: Load data, process and save as Numpy zip
Step 2: Load the processed training images
Step 3: Create the model
Step 4: Callbacks
Step 5: Training method
Step 6: Load the model for tests
Program:
Step 1: Load data, process and save as Numpy zip
Output:
Step 2: Load the processed training images.
Output:
Output:
Step 3: Create the model.
Output:
Step 4: Callbacks.
Output:
Step 5: Training method.
Output:
Step 6: Load the model for tests
Output:
Result:
Thus the python program using object detection using CNN is successfully executed and verified.
EXP.NO:15 DATE:
Aim: To Implement a simple Reinforcement Algorithm for an NLP problem.
.
Project Details:
https://www.analyticsvidhya.com/blog/2022/03/a-hands-on-introduction-to-reinforcement-
learning-with-python/.
https://github.com/ml-for-nlp/reinforcement-learning.
Objective:
Step 1: To Check Random Package
Step 2: Number of Steps Remaining
Step 3: Initialization of Reward Points in Default Constructor.
Program:
Step 1: To Check Random Package.
My Environment:
Step 2: Number of Steps Remaining.
Step 3: Initialization of Reward Points in Default Constructor.
Output:
Result:
Thus the python program using simple Reinforcement Algorithm for an NLP problem is
successfully executed and verified.
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record

More Related Content

Similar to CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record

Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...Chris Fregly
 
running stable diffusion on android
running stable diffusion on androidrunning stable diffusion on android
running stable diffusion on androidKoan-Sin Tan
 
IRJET- Automatic Object Sorting using Deep Learning
IRJET- Automatic Object Sorting using Deep LearningIRJET- Automatic Object Sorting using Deep Learning
IRJET- Automatic Object Sorting using Deep LearningIRJET Journal
 
Learn about Tensorflow for Deep Learning now! Part 1
Learn about Tensorflow for Deep Learning now! Part 1Learn about Tensorflow for Deep Learning now! Part 1
Learn about Tensorflow for Deep Learning now! Part 1Tyrone Systems
 
House price prediction
House price predictionHouse price prediction
House price predictionSabahBegum
 
Tensorflow - Intro (2017)
Tensorflow - Intro (2017)Tensorflow - Intro (2017)
Tensorflow - Intro (2017)Alessio Tonioni
 
A Tour of Tensorflow's APIs
A Tour of Tensorflow's APIsA Tour of Tensorflow's APIs
A Tour of Tensorflow's APIsDean Wyatte
 
Neural Networks with Google TensorFlow
Neural Networks with Google TensorFlowNeural Networks with Google TensorFlow
Neural Networks with Google TensorFlowDarshan Patel
 
Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Ganesan Narayanasamy
 
Advanced Spark and TensorFlow Meetup May 26, 2016
Advanced Spark and TensorFlow Meetup May 26, 2016Advanced Spark and TensorFlow Meetup May 26, 2016
Advanced Spark and TensorFlow Meetup May 26, 2016Chris Fregly
 
Final training course
Final training courseFinal training course
Final training courseNoor Dhiya
 
TENSORFLOW: ARCHITECTURE AND USE CASE - NASA SPACE APPS CHALLENGE by Gema Par...
TENSORFLOW: ARCHITECTURE AND USE CASE - NASA SPACE APPS CHALLENGE by Gema Par...TENSORFLOW: ARCHITECTURE AND USE CASE - NASA SPACE APPS CHALLENGE by Gema Par...
TENSORFLOW: ARCHITECTURE AND USE CASE - NASA SPACE APPS CHALLENGE by Gema Par...Big Data Spain
 
Overview of TensorFlow For Natural Language Processing
Overview of TensorFlow For Natural Language ProcessingOverview of TensorFlow For Natural Language Processing
Overview of TensorFlow For Natural Language Processingananth
 
running Tensorflow in Production
running Tensorflow in Productionrunning Tensorflow in Production
running Tensorflow in ProductionMatthias Feys
 
Natural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usageNatural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usagehyunyoung Lee
 
Introduction to Tensor Flow-v1.pptx
Introduction to Tensor Flow-v1.pptxIntroduction to Tensor Flow-v1.pptx
Introduction to Tensor Flow-v1.pptxJanagi Raman S
 
BlaBlaConf'22 The art of MLOps in TensorFlow Ecosystem
BlaBlaConf'22 The art of MLOps in TensorFlow EcosystemBlaBlaConf'22 The art of MLOps in TensorFlow Ecosystem
BlaBlaConf'22 The art of MLOps in TensorFlow EcosystemTaha Bouhsine
 

Similar to CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record (20)

Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
Hands-on Learning with KubeFlow + Keras/TensorFlow 2.0 + TF Extended (TFX) + ...
 
running stable diffusion on android
running stable diffusion on androidrunning stable diffusion on android
running stable diffusion on android
 
IRJET- Automatic Object Sorting using Deep Learning
IRJET- Automatic Object Sorting using Deep LearningIRJET- Automatic Object Sorting using Deep Learning
IRJET- Automatic Object Sorting using Deep Learning
 
Learn about Tensorflow for Deep Learning now! Part 1
Learn about Tensorflow for Deep Learning now! Part 1Learn about Tensorflow for Deep Learning now! Part 1
Learn about Tensorflow for Deep Learning now! Part 1
 
Introduction to TensorFlow
Introduction to TensorFlowIntroduction to TensorFlow
Introduction to TensorFlow
 
House price prediction
House price predictionHouse price prediction
House price prediction
 
Tensorflow - Intro (2017)
Tensorflow - Intro (2017)Tensorflow - Intro (2017)
Tensorflow - Intro (2017)
 
A Tour of Tensorflow's APIs
A Tour of Tensorflow's APIsA Tour of Tensorflow's APIs
A Tour of Tensorflow's APIs
 
Neural Networks with Google TensorFlow
Neural Networks with Google TensorFlowNeural Networks with Google TensorFlow
Neural Networks with Google TensorFlow
 
Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117
 
Advanced Spark and TensorFlow Meetup May 26, 2016
Advanced Spark and TensorFlow Meetup May 26, 2016Advanced Spark and TensorFlow Meetup May 26, 2016
Advanced Spark and TensorFlow Meetup May 26, 2016
 
Final training course
Final training courseFinal training course
Final training course
 
TensorFlow.pptx
TensorFlow.pptxTensorFlow.pptx
TensorFlow.pptx
 
TENSORFLOW: ARCHITECTURE AND USE CASE - NASA SPACE APPS CHALLENGE by Gema Par...
TENSORFLOW: ARCHITECTURE AND USE CASE - NASA SPACE APPS CHALLENGE by Gema Par...TENSORFLOW: ARCHITECTURE AND USE CASE - NASA SPACE APPS CHALLENGE by Gema Par...
TENSORFLOW: ARCHITECTURE AND USE CASE - NASA SPACE APPS CHALLENGE by Gema Par...
 
Meetup tensorframes
Meetup tensorframesMeetup tensorframes
Meetup tensorframes
 
Overview of TensorFlow For Natural Language Processing
Overview of TensorFlow For Natural Language ProcessingOverview of TensorFlow For Natural Language Processing
Overview of TensorFlow For Natural Language Processing
 
running Tensorflow in Production
running Tensorflow in Productionrunning Tensorflow in Production
running Tensorflow in Production
 
Natural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usageNatural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usage
 
Introduction to Tensor Flow-v1.pptx
Introduction to Tensor Flow-v1.pptxIntroduction to Tensor Flow-v1.pptx
Introduction to Tensor Flow-v1.pptx
 
BlaBlaConf'22 The art of MLOps in TensorFlow Ecosystem
BlaBlaConf'22 The art of MLOps in TensorFlow EcosystemBlaBlaConf'22 The art of MLOps in TensorFlow Ecosystem
BlaBlaConf'22 The art of MLOps in TensorFlow Ecosystem
 

More from Asst.prof M.Gokilavani

CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
IT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdfIT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdfAsst.prof M.Gokilavani
 
IT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notesIT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notesAsst.prof M.Gokilavani
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfAsst.prof M.Gokilavani
 
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfGE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfAsst.prof M.Gokilavani
 
GE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdfGE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdfAsst.prof M.Gokilavani
 
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAsst.prof M.Gokilavani
 
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdfAI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdfAsst.prof M.Gokilavani
 
AI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptxAI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptxAsst.prof M.Gokilavani
 
AI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptxAI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptxAsst.prof M.Gokilavani
 
AI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptxAI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptxAsst.prof M.Gokilavani
 
AI3391 Artificial Intelligence Session 25 Horn clause.pptx
AI3391 Artificial Intelligence Session 25 Horn clause.pptxAI3391 Artificial Intelligence Session 25 Horn clause.pptx
AI3391 Artificial Intelligence Session 25 Horn clause.pptxAsst.prof M.Gokilavani
 

More from Asst.prof M.Gokilavani (20)

CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
IT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdfIT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdf
 
IT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notesIT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notes
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
 
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfGE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
 
GE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdfGE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdf
 
GE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdfGE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdf
 
GE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _NotesGE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _Notes
 
GE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_NotesGE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_Notes
 
GE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_NotesGE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_Notes
 
GE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_NotesGE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_Notes
 
GE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_NotesGE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_Notes
 
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
 
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdfAI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
 
AI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptxAI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptx
 
AI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptxAI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptx
 
AI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptxAI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptx
 
AI3391 Artificial Intelligence Session 25 Horn clause.pptx
AI3391 Artificial Intelligence Session 25 Horn clause.pptxAI3391 Artificial Intelligence Session 25 Horn clause.pptx
AI3391 Artificial Intelligence Session 25 Horn clause.pptx
 

Recently uploaded

Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...ppkakm
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementDr. Deepak Mudgal
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxpritamlangde
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptAfnanAhmad53
 
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...jabtakhaidam7
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...vershagrag
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesChandrakantDivate1
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxNANDHAKUMARA10
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 

Recently uploaded (20)

Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record

  • 1. NEHRU INSTITUTE OF ENGINEERING AND TECHNOLOGY (AUTONOMOUS) Thirumalayampalayam, Coimbatore-641 105 (Approved by AICTE, New Delhi and Affiliated to Anna University, Chennai) An ISO 9001:2015 and ISO 14001:2015 Certified Institution Re-Accredited by NAAC with A+ and Recognized by UGC with Section 2(f) and 12(B) NBA Accredited UG Programmes : AERO | CSE T.M. Palayam, Coimbatore-641105 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CCS335 – Neural Network and Deep Learning Lab SEMESTER - VI REGULATION 2021 NAME : .………………………………………. REG NO : ……………………………………….. DEPARTMENT : .……………………………………….
  • 2. NEHRU INSTITUTE OF ENGINEERING AND TECHNOLOGY (AUTONOMOUS) Thirumalayampalayam, Coimbatore-641 105 (Approved by AICTE, New Delhi and Affiliated to Anna University, Chennai) An ISO 9001:2015 and ISO 14001:2015 Certified Institution Re-Accredited by NAAC with A+ and Recognized by UGC with Section 2(f) and 12(B) NBA Accredited UG Programmes : AERO | CSE T.M. Palayam, Coimbatore-641105 Certified that this is a bonafide record of work done in CCS335 Neural Networks and Deep Learning Lab by Mr. /Ms. Reg.No of this Institution as prescribed by Anna University, Chennai For the VI Semester course in Computer Science and Engineering branch during the academic year 2023- 2024. Staff In charge: Date : HOD Submitted for the university practical examination held on at Nehru Institute of Engineering and Technology, Coimbatore – 641105. ……………………………………. ……………………………………. Internal Examiner External Examiner
  • 3. CCS33 NEURAL NETWORK AND DEEP LEARNING LABORATORY L T P C 3 0 2 4 OBJECTIVES: The main objectives of this course are to:  To understand the basic in deep neural networks  To understand the basic of associative memory and unsupervised learning network.  To apply CNN architecture of deep neural networks.  To analyze the key computations underling deep learning, then use them to build and train deep neural networks for various tasks.  To apply auto encoders and generative models for suitable applications. LIST OF EXPERIMENTS: 1. Implement simple vector addition in Tensor Flow. 2. Implement a regression model in Keras. 3. Implement a perception in TensorFlow/Keras Environment. 4. Implement a Feed Forward Network in TensorFlow/Keras. 5. Implement an image classifier using CNN in TensorFlow/Keras. 6. Improve the deep Learning model by fine tuning hyper parameters. 7. Implement a Transfer Learning concept in image classification. 8. Using a pre trained model on Keras for transfer learning. 9. Perform Sentimental Analysis using RNN. 10. Implement an LSTM based Auto encoding inTensorflow/Keras. 11. Image generation using GAN. ADDITIONAL EXPERIMENTS 12. Train a deep Learning model to classify a given image using pre trained model. 13. Recommendation system from sales data using Deep Learning. 14. Implement Object detection using CNN. 15. Implement any simple Reinforcement Algorithm for an NLP problem. TOTAL: 60 PERIODS OUTCOMES: After the Completion of the course, the students will be able to:  Apply Convolution Neural Network for image processing.  Understand the basics of associative memory and unsupervised learning networks.  Apply CNN and its variants for suitable applications.  Analyze the key computations underlying deep learning and use them to build and train deep neural networks for various tasks.  Apply auto encoders and generative models for suitable applications. SOFTWARE REQUIRED: ● Jupiter Notebook, Colab.
  • 4. LIST OF EXPERIMENTS EX.NO. DATE NAME OF THE EXPERIMENT PAGE NO. SIGNATURE 1. Implement simple vector addition in Tensor Flow. 2. Implement a regression model in Keras. 3. Implement a perception in TensorFlow/Keras Environment. 4. Implement a Feed Forward Network in TensorFlow/Keras. 5. Implement an image classifier using CNN in TensorFlow/Keras. 6. Improve the deep Learning model by fine tuning hyper parameters. 7. Implement a Transfer Learning concept in image classification. 8. Using a pre trained model on Keras for transfer learning. 9. Perform Sentimental Analysis using RNN. 10. Implement an LSTM based Auto encoding inTensorflow/Keras. 11. Image generation using GAN. 12. Train a deep Learning model to classify a given image using pre trained model. 13. Recommendation system from sales data using Deep Learning. 14. Implement Object detection using CNN. 15. Implement any simple Reinforcement Algorithm for an NLP problem.
  • 5. EXP.NO:0 DATE: BASIC OF TENSERFLOW Aim: To study the basic of tensor flow along python programs using Colab laboratory. Questions: i. Architecture of tensor flow ii. How to convert Numpy array to tensor flow iii. Matrix using tensor flow Description: i. Architecture of Tensor Flow  TensorFlow is an end-to-end open-source machine learning platform developed by Google.  It is scalable and flexible, running on various devices like data centers and mobile phones.  Computation in TensorFlow is represented by a directed graph with nodes as operations/functions and edges as input/output flows.  Tensors, multi-dimensional arrays, serve as inputs and outputs in TensorFlow.  The architecture includes device and network layers, kernel implementations, distributed components, and API layers in C.  Advanced features include custom operations, custom gradients, TensorFlow Eager Execution, TensorFlow Keras, TensorFlow Probability, and TensorFlow Model Optimization.  TensorFlow is widely used for image classification, natural language processing, time-series analysis, generative models, reinforcement learning, and anomaly detection.
  • 6. ii. Convert Numpy array to tensor flow The syntax for converting numpy array to tensor flow is : tf.convert_to_tensor(value, dtype=None, dtype_hint=None, name=None)  value: The input object to be converted into a tensor. It can be a NumPy array, Python list, scalar value, etc. This parameter is mandatory.  dtype: (Optional) The data type of the elements in the resulting tensor. If not specified, the data type is inferred from the type of the value. It allows to explicitly set the data type for the tensor.  dtype_hint: (Optional) When dtype is None, dtype_hint is an optional preferred data type for the resulting tensor. It serves as a hint to TensorFlow about the preferred data type but has no effect if the conversion is not possible. This parameter is useful when you want to suggest a preferred data type without enforcing it.  name: (Optional) An optional name for the resulting tensor. If a new tensor is produced during the conversion, this name can be used to identify it in the TensorFlow graph. The tf.convert_to_tensor() function is widely employed to transform various types of objects, including NumPy arrays, into TensorFlow tensors. The resulting tensor can then be seamlessly integrated into TensorFlow operations and workflows. iii. Matrix using Tensorflow The syntax for creating a matrix using TensorFlow's `tf.constant()` is : tf.constant(value, dtype=None, shape=None, name='Const', verify_shape=False)  value: The values to be used for initializing the constant tensor. In the context of creating a matrix, this would be a nested list representing the matrix elements.  dtype: (Optional) The data type of the elements in the tensor. If not specified, the data type is inferred from the type of the `value`.  shape: (Optional) The shape of the tensor. For creating a matrix, you can specify the shape as a tuple representing the number of rows and columns.  name: (Optional) An optional name for the operation.  verify_shape: (Optional) A boolean that controls whether to check if the shape of the provided value matches the specified shape argument. If set to `True` and the shapes do not match, a `ValueError` will be raised.
  • 7. Program: i.Tensor Flow: Output: tf.Tensor( [[1 2] [3 4]], shape=(2, 2), dtype=int64) ii.Convert Numpy array to tensor flow: Output: <tf.Variable 'tensor1:0' shape=(2, 2) dtype=float32, numpy= array([[1., 2.], [3., 4.]], dtype=float32)> iii.Matrix using Tensorflow: import tensorflow as tf import numpy as np numpy_array = np.array([[1,2],[3,4]]) tensor1 = tf.convert_to_tensor(numpy_array) print(tensor1) import tensorflow as tf import numpy as np numpy_array = np.array([[1, 2], [3, 4]]) tensor1 = tf.Variable(numpy_array, dtype=float, name='tensor1') tensor1 import tensorflow as tf matrix_data = [[1, 2, 3], [4, 5, 6]] matrix_tensor = tf.constant(matrix_data, dtype=tf.int32, shape=(2, 3), name='MyMatrix') print("TensorFlow Matrix:") print(matrix_tensor)
  • 8. Output: TensorFlow Matrix: tf.Tensor( [[1 2 3] [4 5 6]], shape=(2, 3), dtype=int32) Result: Thus the python program using tensor flow for above experiment is successfully executed and verified.
  • 9. EXP.NO:1 DATE: Aim: To Implement simple vector addition in Tensor Flow using Colab laboratory. Questions: 1. Scalar 2. Checking the dimensions of scalar 3. Vector 4. Checking the dimensions of vector 5. Matrix 6. Mathematical Operation i. Addition ii. Subtraction iii. Multiplication iv. Division v. Transpose vi. Dot Product Algorithm: 1. Start Colab: a. Open Google Colab in your web browser. b. Create a new notebook. 2. Scalar: a. Import TensorFlow. b. Define a scalar using `tf.constant()`. 3. Checking the Dimensions of Scalar: a. Use `scalar.ndim` to find dimension of scalar. 4. Vector: a. Define a vector using `tf.constant()` with a 1D array. 5. Checking the Dimensions of Vector: a. Use `vector.ndim` to find dimension of vector. 6. Matrix: a. Define a matrix using `tf.constant()` with a 2D array. 7. Mathematical Operations: i. Addition: a. Use `tf.add()` for element-wise addition.
  • 10. ii. Subtraction: a. Use `tf.subtract()` for element-wise subtraction. iii. Multiplication: a. Use `tf.multiply()` for element-wise multiplication. iv. Division: a. Use `tf.divide()` for element-wise division. v. Transpose: a. Use `tf.transpose()` for matrix transposition. vi. Dot Product: a. Use `tf.tensordot()` for matrix multiplication. 8. Run the Code: a. Execute each cell in the Colab notebook to see the results. Program: 1.Scalar: Output: <tf.Tensor: shape=(), dtype=int32, numpy=7> 2.Dimensions of Scalar: Output: 0 3.Vector: # importing packages import tensorflow as tf # creating a scalar scalar = tf.constant(7) scalar #checking dimensions of scalar scalar.ndim # importing packages import tensorflow as tf # create a vector vector = tf.constant([10, 10]) vector
  • 11. Output: <tf.Tensor: shape=(2,), dtype=int32, numpy=array([10, 10], dtype=int32)> 4.Dimensions of Vector: Output: 1 5.Matrix: Output: tf.Tensor( [[1 2] [3 4]], shape=(2, 2), dtype=int32) The number of dimensions of a matrix is :2 6.Mathematical Operations: i.Addition: Output: tf.Tensor( [[ 3 6] [ 9 12]], shape=(2, 2), dtype=int32) # importing packages import tensorflow as tf # creating two tensors matrix = tf.constant([[1, 2], [3, 4]]) matrix1 = tf.constant([[2, 4], [6, 8]]) # addition of two matrices result = tf.add(matrix, matrix1) print(result) # checking the dimensions of vector vector.ndim # importing packages import tensorflow as tf # creating a matrix matrix = tf.constant([[1, 2], [3, 4]]) print(matrix) print('the number of dimensions of a matrix is : '+str(matrix.ndim))
  • 12. ii.Subtraction: Output: tf.Tensor( [[1 2] [3 4]], shape=(2, 2), dtype=int32) ii.Multiplication: Output: tf.Tensor( [[ 2 8] [18 32]], shape=(2, 2), dtype=int32) [15 22]], shape=(2, 2), dtype=int32 # importing packages import tensorflow as tf # creating two tensors matrix = tf.constant([[1, 2], [3, 4]]) matrix1 = tf.constant([[2, 4], [6, 8]]) # multiplication of two matrices result=tf.multiply(matrix,matrix1) print(result) # importing packages import tensorflow as tf # creating two tensors matrix = tf.constant([[1, 2], [3, 4]]) matrix1 = tf.constant([[2, 4], [6, 8]]) # subtraction of two matrices result=tf.subtract(matrix,matrix1) print(result)
  • 13. iii.Division: Output: tf.Tensor( [[2. 2.] [2. 2.]], shape=(2, 2), dtype=float64) iv. Transpose: Output: tf.Tensor( [[1 3] [2 4]], shape=(2, 2), dtype=int32) # importing packages import tensorflow as tf # creating two tensors matrix = tf.constant([[1, 2],[3, 4]]) matrix1 = tf.constant([[2, 4],[6, 8]]) # division of two matrices result=tf.divide(matrix,matrix1) print(result) # importing packages import tensorflow as tf # creating a matrix matrix = tf.constant([[1, 2], [3, 4]]) # transpose of the matrix print(tf.transpose(matrix))
  • 14. v. Dot Product: Output: dot product of matrices is : tf.Tensor( [[ 7 10] Result: Thus the python program using tensor flow for about mathematical operations is successfully executed and verified. # importing packages import tensorflow as tf # creating a matrix matrix = tf.constant([[1, 2], [3, 4]]) # dot product of matrices print('dot product of matrices is : ' + str(tf.tensordot(matrix, matrix, axes=1)))
  • 15. EXP.NO:2 DATE: Aim: To Implement a regression model in Keras using mnist -dataset in Colab laboratory. Dataset Details: Mnist Dataset: https://www.kaggle.com/datasets/oddrationale/mnist-in-csv Objective: Step 1 - Import the library Step 2 - Loading the Dataset Step 3 - Creating Regression Model Step 4 - Compiling the model Step 5 - Fitting the model Step 6 - Evaluating the model Step 7 - Predicting the output Description: 1.Import The Libraries:  Import necessary libraries: Pandas, Numpy, Keras, Scikit-learn, etc., . 2.Upload The Dataset:  Upload the dataset in drive using mount drive method. 3.Load The Dataset:  Load the mnist_train and mnsit_test datasets. 4.Data Preprocessing:  Change the pixels od the dataset to perform further actions. 5.Creating Regression Model:  Create a sequential model with two args.  Add linear stack of layers and use activation function ‘relu’.
  • 16. 6.Compiling the Model:  Compile the model with the Adam optimizer, mean squared error as the loss function, and mean absolute error as the evaluation metric. 7.Fitting the Model:  Split the dataset into training and testing sets using scikit-learn.  Standardize the input features using the StandardScaler from scikit-learn.  Use training data for fitting the model and use paramaters like epochs, batch_size, verbose, etc., . 8.Evaulating The Model:  Use model.evaluate to evaluate the model and it will give us the loss and the accuracy.  Here we have also printed the score. 9.Predicting The Output:  Use another part of the data that we get from test_train_split i.e. test data.  We will use it and predict the output. Program: 1.Import The Library: 2.Upload The Dataset: drive.mount('/content/drive') Output: Mounted at /content/drive import pandas as pd import numpy as np from keras.datasets import mnist from sklearn.model_selection import train_test_split from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout from google.colab import drive
  • 17. 3.Load The Dataset: 4.Data Preprocessing: X_train = X_train.astype('float32') / 255 X_test = X_test.astype('float32') / 255 y_train = y_train.astype('float32') / 255 y_test = y_test.astype('float32') / 255 5.Creating Regression Model: 6.Compiling The Model: 7.Fitting The Model: mnist_train = pd.read_csv("/content/drive/MyDrive/mnist_test.csv") mnist_test = pd.read_csv("/content/drive/MyDrive/mnist_train.csv") X_train = mnist_train.drop("label", axis=1).values y_train = mnist_train["label"].values X_test = mnist_test.drop("label", axis=1).values y_test = mnist_test["label"].values model = Sequential() model.add(Dense(512, activation='relu')) model.add(Dropout(0.5)) model.add(Dense(256, activation='relu')) model.add(Dropout(0.25)) model.add(Dense(10)) model.compile(loss='sparse_categorical_crossentropy', optimizer='adam', metrics=['accuracy']) model.fit(X_train, y_train, batch_size=128, epochs=2, verbose=1, validation_data=(X_test, y_test)) model.summary()
  • 18. Output: Epoch 1/2 79/79 [==============================] - 9s 98ms/step - loss: 0.1766 - accuracy: 0.0957 - val_loss: 9.5367e-07 - val_accuracy: 0.0987 Epoch 2/2 79/79 [==============================] - 9s 109ms/step - loss: 9.5367e-07 - accuracy: 0.0980 - val_loss: 9.5367e-07 - val_accuracy: 0.0987 Model: "sequential_3" Layer (type) Output Shape Param # ================================================================= dense_6 (Dense) (None, 512) 401920 dropout_4 (Dropout) (None, 512) 0 dense_7 (Dense) (None, 256) 131328 dropout_5 (Dropout) (None, 256) 0 dense_8 (Dense) (None, 10) 2570 ================================================================= Total params: 535818 (2.04 MB) Trainable params: 535818 (2.04 MB) Non-trainable params: 0 (0.00 Byte) 8.Evaluating the Model: Output: Test loss: 9.536742595628311e-07 Test accuracy: 0.09871666878461838 score = model.evaluate(X_test, y_test, verbose=0) print('Test loss:', score[0]) print('Test accuracy:', score[1])
  • 19. 9.Predicting the Output: Output: 1875/1875 [==============================] - 10s 5ms/step [[ 7.6505547 -5.039996 -4.8032265 ... -5.1202197 -4.11554 -4.5914993] [ 8.687883 -5.6656256 -5.358442 ... -5.6097336 -4.4189353 -4.6995463] [ 5.088747 -3.361604 -3.19289 ... -3.178188 -2.7151685 -2.9893024] ... [ 6.4936686 -4.0753646 -3.68436 ... -4.2753725 -3.3604608 -3.5153835] [ 5.344781 -3.5582738 -3.5012681 ... -3.5117133 -2.885717 -3.028985 ] [ 5.977292 -3.7096646 -3.6107407 ... -3.9403937 -3.1786413 -3.3968258]] Result: Thus the python program using tensor flow for Regression in Keras is successfully executed and verified. y_pred = model.predict(X_test) print(y_pred)
  • 20. EXP.NO:3 DATE: Aim: To Implement a Perceptron using Keras/ Tensor flow environment. Project Details: https://www.geeksforgeeks.org/multi-layer-perceptron-learning-in-tensorflow/ https://www.geeksforgeeks.org/single-layer-perceptron-in-tensorflow/ Objective: Step1: Import necessary libraries Step 2: Now load the dataset using “Keras” from the imported version of tensor flow. Step 3: Now display the shape and image of the single image in the dataset. The image size contains a 28*28 matrix and length of the training set is 60,000 and the testing set is 10,000. Step 4: Now normalize the dataset in order to compute the calculations in a fast and accurate manner. Step 5: Building a neural network with single-layer perception. Here we can observe as the model is a single-layer Perceptron that only contains one input layer and one output layer there is no presence of the hidden layers. Step 6: Output the accuracy of the model on the testing data. Description: 1.Import the Libraries:  Essential libraries are imported including TensorFlow and Keras for building and training neural networks, Numpy for numerical operations, and Matplotlib for visualization. 2.Upload the Dataset:  Dataset is uploaded in drive using mount drive method. 3.Load the Dataset:  The MNIST dataset, consisting of 60,000 training images and 10,000 testing images of handwritten digits (0-9), is loaded. 4.Displaying Dataset:  Information about the dataset is printed, including the shapes of training and testing data.  Additionally, the first image from the training set is displayed for visualization.
  • 21. 5.Normalizing the Dataset:  The pixel values of the images are normalized to a range between 0 and 1 by dividing each pixel value by 255.0.  This standardizes the data and helps in faster convergence during training. 6.Flattening the Image:  The input images are flattened from a 28x28 matrix to a 1D array of length 784 to match the input shape expected by the model. 7.Building the Model:  Building a neural network with single-layer perception.  Here we can observe as the model is a single-layer perceptron that only contains one input layer and one output layer there is no presence of the hidden layers. 8.Output Accuracy:  The model's accuracy is evaluated on the testing data using the evaluate () method.  The accuracy is then printed out as a percentage, indicating how well the model generalizes to unseen data. Program: 1.Import The Libraries: 2.Upload The Dataset: drive.mount('/content/drive') import numpy as np import pandas as pd import tensorflow as tf from tensorflow import keras import matplotlib.pyplot as plt %matplotlib inline from google.colab import drive import matplotlib.pyplot as plt
  • 22. 3.Load The Dataset: 4.Displaying The Dataset: Output: Training data shape: (10000, 784) Testing data shape: (60000, 784) Shape of the first image: (784,) <matplotlib.image.AxesImage at 0x796ebbf83d60> mnist_train = pd.read_csv("/content/drive/MyDrive/mnist_test.csv") mnist_test = pd.read_csv("/content/drive/MyDrive/mnist_train.csv") x_train = mnist_train.drop("label", axis=1).values y_train = mnist_train["label"].values x_test = mnist_test.drop("label", axis=1).values y_test = mnist_test["label"].values print("Training data shape:", x_train.shape) print("Testing data shape:", x_test.shape) print("Shape of the first image:", x_train[0].shape) # Reshape the flattened image into a 2D array and display first image image = np.reshape(x_train[0], (28, 28)) plt.imshow(image)
  • 23. 5.Normalizing The Dataset: x_train = x_train.astype('float32') / 255 x_test = x_test.astype('float32') / 255 y_train = y_train.astype('float32') / 255 y_test = y_test.astype('float32') / 255 6.Flatenning The Image: 1. Building The Model: Output: Epoch 1/5 313/313 [==============================] - 1s 1ms/step - loss: 0.0888 - accuracy: 0.0975 Epoch 2/5 313/313 [==============================] - 0s 1ms/step - loss: 0.0051 - accuracy: 0.0980 Epoch 3/5 313/313 [==============================] - 0s 1ms/step - loss: 0.0024 - accuracy: 0.0980 Epoch 4/5 313/313 [==============================] - 0s 1ms/step - loss: 0.0015 - accuracy: 0.0980 Epoch 5/5 313/313 [==============================] - 0s 1ms/step - loss: 9.8897e-04 - accuracy: 0.0980 <keras.src.callbacks.History at 0x796ebbe53a30> x_train_flatten = x_train.reshape(len(x_train), 28*28) x_test_flatten = x_test.reshape(len(x_test), 28*28) model = keras.Sequential([ keras.layers.Dense(10, input_shape=(784,), activation='sigmoid') ]) model.compile( optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy']) model.fit(x_train_flatten, y_train, epochs=5)
  • 24. 2. Output Accuracy: Output: 1875/1875 [==============================] - 3s 2ms/step - loss: 8.6323e-04 - accuracy: 0.0987 Accuracy: 9.87% Result: Thus the python program using tensor flow for Regression in Keras is successfully executed and verified. evaluation_results = model.evaluate(x_test_flatten, y_test) accuracy = evaluation_results[1] # Convert accuracy to percentage accuracy_percentage = accuracy * 100 # Print accuracy print("Accuracy: {:.2f}%".format(accuracy_percentage))
  • 25. EXP.NO:4 DATE: Aim: To Implement a Feed Forward network using Keras/ Tensor flow environment. Project Details: https://www.analyticsvidhya.com/blog/2016/10/an-introduction-to-implementing-neural-networks-using- tensorflow/ Objective: A typical implementation of Neural Network would be as follows: Step 1: Define Neural Network architecture to be compiled. Step 2: Transfer data to your model. Step 3: Under the hood, the data is first divided into batches, so that it can be ingested. The batches are first preprocessed, augmented and then fed into Neural Network for training Step 4: The model then gets trained incrementally. Step 5: Display the accuracy for a specific number of time steps. Step 6: After training save the model for future use. Step 7: Test the model on a new data and check how it performs Program: i. Implementing Scikit-learn The usual workflow of running a program in TensorFlow is as follows:  Build a computational graph, this can be any mathematical operation TensorFlow supports.  Initialize variables, to compile the variables defined previously  Create session, this is where the magic starts!  Run graph in session, the compiled graph is passed to the session, which starts its execution. Close session, shutdown the session. Few terminologies used in TensorFlow;
  • 26.  placeholder: A way to feed data into the graphs  feed_dict: A dictionary to pass numeric values to computational graph  Step 1: Define Neural Network architecture to be compiled. We can control our models randomness Set Directory Paths  Step 2: Transfer data to your model. Output:
  • 27.  Step 3: Under the hood, the data is first divided into batches, so that it can be ingested. The batches are first preprocessed, augmented and then fed into Neural Network for training. Output:
  • 28.  Step 4: The model then gets trained incrementally.  Step 5: Display the accuracy for a specific number of time steps.
  • 29. Output:  Step 6: After training save the model for future use.
  • 30. Output:  Step 7: Test the model on a new data and check how it performs Output: Result: Thus the python program using tensor flow for Regression in Keras is successfully executed and verified.
  • 31. EXP.NO:5 DATE: Aim: To Implement an Image classifier using CNN in Keras/ Tensor flow environment. Project Details: https://www.tensorflow.org/tutorials/images/cnn Objective: Step 1: Import TensorFlow. Step 2: Download and prepare the CIFAR10 dataset. Step 3: Verify the data. Step 4: Create the convolutional base. Step 5: Add dense layers on top. Step 6: Compile and train the model. Step 7: Evaluate the model. Program: Step 1: Import TensorFlow. Output: Step 2: Download and prepare the CIFAR10 dataset. The CIFAR10 dataset contains 60,000 color images in 10 classes, with 6,000 images in each class. The dataset is divided into 50,000 training images and 10,000 testing images. The classes are mutually exclusive and there is no overlap between them.
  • 32. Output: Step 3: Verify the data. To verify that the dataset looks correct, let's plot the first 25 images from the training set and display the class name below each image: Output:
  • 33. Step 4: Create the convolutional base. The 6 lines of code below define the convolutional base using a common pattern: a stack of Conv2D and MaxPooling2D layers. As input, a CNN takes tensors of shape (image height, image width, color channels), ignoring the batch size. If you are new to these dimensions, color channels refers to (R, G, and B). In this example, you will configure your CNN to process inputs of shape (32, 32, 3), which is the format of CIFAR images. You can do this by passing the argument input shape to your first layer. Output:
  • 34. Step 5: Add dense layers on top. To complete the model, you will feed the last output tensor from the convolutional base (of shape (4, 4, and 64)) into one or more Dense layers to perform classification. Dense layers take vectors as input (which are 1D), while the current output is a 3D tensor. First, you will flatten (or unroll) the 3D output to 1D, then add one or more Dense layers on top. CIFAR has 10 output classes, so you use a final dense layer with 10 outputs. Output: Step 6: Compile and train the model.
  • 36. Output: Result: Thus the python program using tensor flow for Regression in Keras is successfully executed and verified.
  • 37. EXP.NO:6 DATE: Aim: To Implement a Deep learning model by fine turning parameters. Project Details: https://pyimagesearch.com/2019/06/03/fine-tuning-with-keras-and-deep-learning/ https://www.analyticsvidhya.com/blog/2021/05/tuning-the-hyperparameters-and-layers-of-neural- network-deep-learning/ Objective: Step 1: Imports useful packages for Neural Network modeling. Step 2: Makes accuracy the scorer metric. Step 3: Load Dataset Step 4: Function will return returns the score of the cross-validation. Step 5: Sets the range of hyper parameters and run the Bayesian Optimization. Step 6: Best hyper parameters. Step 7: Creates a function for tuning the Neural Network hyper parameters and layers. Step 8: Tuned hyper parameters and layers. Step 9: Fitting Neural Network. Program: Step 1: Imports useful packages for Neural Network modeling. Step 2: Makes accuracy the scorer metric.
  • 38. Step 3: Load Dataset Step 4: Function will return returns the score of the cross-validation.
  • 39. Step 5: Sets the range of hyper parameters and run the Bayesian Optimization. Output:
  • 40. Step 6: Best hyper parameters. Output: Step 7: Creates a function for tuning the Neural Network hyper parameters and layers.
  • 42. Step 8: Tuned hyper parameters and layers. Output:
  • 43. Step 9: Fitting Neural Network. Output: Result: Thus the python program using tensor flow for Regression in Keras is successfully executed and verified.
  • 44. EXP.NO:7 DATE: Aim: To Implement a Transfer learning concept in image Classification. Project Details: https://www.geeksforgeeks.org/multiclass-image-classification-using-transfer-learning/ https://www.analyticsvidhya.com/blog/2021/10/understanding-transfer-learning-for-deep- learning/ Objective: Step 1: Importing Libraries Step 2: Uploading Data via Kaggle API Step 3: Designing Our CNN Model with help of Pre–Trained Model Step 4: Image Augmentation (For preventing the issue of over fitting) Step 5: Training Our Model. Step 6: Making Predictions. Program: Step 1: Importing Libraries.
  • 45. Step 2: Uploading Data via Kaggle API Step 3: Designing Our CNN Model with help of Pre–Trained Model. Step 4: Image Augmentation (For preventing the issue of over fitting).
  • 46. Step 5: Training Our Model. Step 6: Making Predictions.
  • 47. Output: Result: Thus the python program using tensor flow for Regression in Keras is successfully executed and verified.
  • 48. EXP.NO:8 DATE: Aim: To Implement a Pretrained model for Keras for transfer learning. Project Details: https://www.geeksforgeeks.org/multiclass-image-classification-using-transfer-learning/ https://www.analyticsvidhya.com/blog/2017/06/transfer-learning-the-art-of-fine-tuning-a-pre-trained- model/. Objective: Step 1: Retrain the output dense layers only. Step 2: Freeze the weights of first few layers. Program: Step 1: Retrain the output dense layers only. Step 2: Freeze the weights of first few layers.
  • 49. Output: Output: Result: Thus the python program using tensor flow for Regression in Keras is successfully executed and verified.
  • 50. EXP.NO:9 DATE: Aim: To perform Sentimental Analysis using RNN. Project Details: https://towardsdatascience.com/a-beginners-guide-on-sentiment-analysis-with-rnn-9e100627c02e. https://www.kaggle.com/code/rahulagg/sentiment-analysis-using-rnn. Objective: Step 1: Importing Libraries and Dataset Step 2: load in training and test data. Step 3: Loaded dataset with 25000 training samples, 25000 test samples. Step 4: Pad sequences. Step 5: Design an RNN model for sentiment analysis. Step 6: Train and evaluate our model. Program: Step 1: Importing Libraries and Dataset. The data: We will use Recurrent Neural Networks, and in particular LSTMs, to perform sentiment analysis in Keras. Conveniently, Keras has a built-in IMDb movie reviews data set that we can use. Step 2: load in training and test data. Step 3: Loaded dataset with 25000 training samples, 25000 test samples.
  • 51. Output: That the review is stored as a sequence of integers. These are word IDs that have been pre-assigned to individual words, and the label is an integer (0 for negative, 1 for positive). Output: Maximum review length and minimum review length. Maximum review length: 2697 Minimum review length: 14
  • 52. Step 4: Pad sequences. Step 5: Design an RNN model for sentiment analysis. Output: Step 6: Train and evaluate our model.
  • 53. Output: Result: Thus the python program using tensor flow for Sentimental Analysis using RNN is successfully executed and verified.
  • 54. EXP.NO:10 DATE: Aim: To Implement an LSTM based Auto encoding inTensorflow/Keras. Project Details: https://analyticsindiamag.com/introduction-to-lstm-autoencoder-using- keras/#:~:text=LSTM%20autoencoder%20is%20an%20encoder,original%20structure%20using %20a%20decoder.&text=Simple%20Neural%20Network%20is%20feed,ventures%20just%20in %20one%20direction. Objective: Step 1: Import libraries required for this project Step 2: Read the data Step 3: Split the data Step 4: Pre-Processing of Data Step 5: Create a sequence with historical data Step 6: Creating an LSTM Auto encoder Network Step 7: Fitting the Model Step 8: Evaluation Step 9: Actual Value of Test Data Step 10: Prediction on Test Data. Program: Step 1: Import libraries required for this project. Step 2: Read the data.
  • 55. Step 3: Split the data. Step 4: Pre-Processing of Data. Step 5: Create a sequence with historical data.
  • 56. Step 6: Creating an LSTM Auto encoder Network
  • 57. Step 7: Fitting the Model. Step 8: Evaluation. Step 9: Actual Value of Test Data. Step 10: Prediction on Test Data. Result: Thus the python program using LSTM based Auto encoding in Keras is successfully executed and verified.
  • 58. EXP.NO: 11 DATE: Aim: To Implement an Image generation using GAN. Project Details: https://www.scaler.com/topics/deep-learning/gans-image-generation/ https://www.analyticsvidhya.com/blog/2021/03/why-are-generative-adversarial-networksgans-so- famous-and-how-will-gans-be-in-the-future/. Objective: Step 1: Reading the Dataset Step 2: Defining the Generator. Step 3: Defining the Discriminator. Step 4: Computing the Loss Function Step 5: Optimizing the Loss Step 6: Generating Handwritten Digits. Requirements Before creating the GAN's image generation module, we must import a few libraries.  We will import all the functions, layers, and dataset loaders from TensorFlow.  We will also import Numpy (a math library) and matplotlib (a plotting library). Building the Model The GAN we want to create comprises two major parts:  Generator  Discriminator. The Generator is responsible for creating novel images, while the Discriminator is responsible for understanding how good the generated image is. Program: Step 1: Reading the Dataset. The MNIST (Modified National Institute of Standards and Technology) dataset. This dataset has more handwritten digits of 28x28 and is one of computer vision's most widely used datasets. The MNIST is an easy dataset for a GAN such as the one we are building, as it has small, single channels images.
  • 59. Step 2: Defining the Generator The job of the Generator (D) is to create realistic images that the Discriminator fails to understand are fake. Thus, the Generator is an essential component that enables a GANs image generation ability. The architecture we consider in this article comprises fully connected layers (FC) and Leaky ReLU activations. The final layer of the Generator has a TanH activation rather than a LeakyReLU. This replacement was done because we wanted to convert the generated image to the same range as the original MNIST dataset (-1, 1).
  • 60. Step 3: Defining the Discriminator.
  • 61. Step 4: Computing the Loss Function. Step 5: Optimizing the Loss.
  • 62. Step 6: Generating Handwritten Digits. We trained the GAN for around 10,000 epochs with a batch size of 32. We save the generated images every 200 epochs in the images folder. Output: Result: Thus the python program using Image generation using GAN in Keras is successfully executed and verified.
  • 64. EXP.NO:12 DATE: Aim: To implement a train a deep Learning model to classify a given image using pre trained model. Project Details: https://learnopencv.com/pytorch-for-beginners-image-classification-using-pre-trained-models/. https://www.analyticsvidhya.com/blog/2017/06/transfer-learning-the-art-of-fine-tuning-a-pre-trained- model/ Objective: Step 1: Reading the input image. Step 2: Performing transformations on the image. For example – resize, center crop, normalization, etc. Step 3: Forward Pass: Use the pre-trained weights to find out the output vector. Each element in this output vector describes the confidence with which the model predicts the input image belongs to a particular class. Step 4: Based on the scores obtained (elements of the output vector mentioned in step 3), display the predictions. Step 5: Load the pre-trained model Step 6: Specify image transformations Step 7: Load the input image and pre-process it Step 8: Model Inference
  • 65. Program: Step 1: Reading the input image. Step 2: Performing transformations on the image. For example – resize, center crop, normalization, etc. Step 3: Forward Pass: Use the pre-trained weights to find out the output vector. Each element in this output vector describes the confidence with which the model predicts the input image belongs to a particular class. Step 4: Based on the scores obtained (elements of the output vector mentioned in step 3), display the predictions. Step 5: Load the pre-trained model.
  • 66. Step 6: Specify image transformations. Step 7: Load the input image and pre-process it. Output:
  • 67. Step 8: Model Inference. Output:
  • 68. Result: Thus the python program using a deep learning model to classify a given image using pre trained model in Keras is successfully executed and verified.
  • 69. EXP.NO:13 DATE: Aim: To Implement a recommendation system from sales data using Deep Learning. Project Details: https://www.javatpoint.com/sales-prediction-using-machine-learning. https://www.analyticsvidhya.com/blog/2020/08/building-sales-prediction-web-application-using- machine-learning-dataset/ Objective: Step 1: Importing Libraries. Step 2: Loading and Exploration of the Data. Step 3: EDA (Exploratory Data Analysis). Step 4: Determining Time Series Stationary. Step 5: Differencing. Program: Step 1: Importing Libraries.
  • 70. Step 2: Loading and Exploration of the Data. Output:
  • 71. Step 3: EDA (Exploratory Data Analysis).
  • 73. Step 4: Determining Time Series Stationary. Output:
  • 74. Step 5: Differencing. Output: Result: Thus the python program using a recommendation system from sales data using Deep Learning is successfully executed and verified.
  • 75. EXP.NO:14 DATE: Aim: To Implement object detection using CNN. Project Details: https://www.kaggle.com/code/silviua/object-detection-cnn https://www.analyticsvidhya.com/blog/2018/11/implementation-faster-r-cnn-python-object-detection/ Objective: Step 1: Load data, process and save as Numpy zip Step 2: Load the processed training images Step 3: Create the model Step 4: Callbacks Step 5: Training method Step 6: Load the model for tests Program: Step 1: Load data, process and save as Numpy zip
  • 76. Output: Step 2: Load the processed training images. Output:
  • 77.
  • 82. Output: Step 6: Load the model for tests
  • 83. Output: Result: Thus the python program using object detection using CNN is successfully executed and verified.
  • 84. EXP.NO:15 DATE: Aim: To Implement a simple Reinforcement Algorithm for an NLP problem. . Project Details: https://www.analyticsvidhya.com/blog/2022/03/a-hands-on-introduction-to-reinforcement- learning-with-python/. https://github.com/ml-for-nlp/reinforcement-learning. Objective: Step 1: To Check Random Package Step 2: Number of Steps Remaining Step 3: Initialization of Reward Points in Default Constructor. Program: Step 1: To Check Random Package. My Environment:
  • 85. Step 2: Number of Steps Remaining. Step 3: Initialization of Reward Points in Default Constructor.
  • 86. Output: Result: Thus the python program using simple Reinforcement Algorithm for an NLP problem is successfully executed and verified.