0% found this document useful (0 votes)
32 views40 pages

AI Module V

Uploaded by

amitpatharmora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views40 pages

AI Module V

Uploaded by

amitpatharmora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

B.

Tech CSE AIML, 5th Semester


Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
Module V
Introduction to Deep Learning
Deep learning is based on the branch of machine learning, which is a subset of artificial
intelligence. Since neural networks imitate the human brain and so deep learning will do. In
deep learning, nothing is programmed explicitly. Basically, it is a machine learning class that
makes use of numerous nonlinear processing units so as to perform feature extraction as well
as transformation. The output from each preceding layer is taken as input by each one of the
successive layers.
Deep learning models are capable enough to focus on the accurate features themselves by
requiring a little guidance from the programmer and are very helpful in solving out the problem
of dimensionality. Deep learning algorithms are used, especially when we have a huge no of
inputs and outputs.
Since deep learning has been evolved by the machine learning, which itself is a subset of
artificial intelligence and as the idea behind the artificial intelligence is to mimic the human
behaviour, so same is "the idea of deep learning to build such algorithm that can mimic the
brain".
Deep learning is implemented with the help of Neural Networks, and the idea behind the
motivation of Neural Network is the biological neurons, which is nothing but a brain cell.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025

Fully Connected Artificial Neural Network


Artificial neurons, also known as units, are found in artificial neural networks. The whole
Artificial Neural Network is composed of these artificial neurons, which are arranged in a
series of layers. The complexities of neural networks will depend on the complexities of the
underlying patterns in the dataset whether a layer has a dozen units or millions of units.
Commonly, Artificial Neural Network has an input layer, an output layer as well as hidden
layers. The input layer receives data from the outside world which the neural network needs to
analyze or learn about.
In a fully connected artificial neural network, there is an input layer and one or more hidden
layers connected one after the other. Each neuron receives input from the previous layer
neurons or the input layer. The output of one neuron becomes the input to other neurons in the
next layer of the network, and this process continues until the final layer produces the output
of the network. Then, after passing through one or more hidden layers, this data is transformed
into valuable data for the output layer. Finally, the output layer provides an output in the form
of an artificial neural network’s response to the data that comes in.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
Units are linked to one another from one layer to another in the bulk of neural networks. Each
of these links has weights that control how much one unit influences another. The neural
network learns more and more about the data as it moves from one unit to another, ultimately
producing an output from the output layer.
Difference between Machine Learning and Deep Learning :
machine learning and deep learning both are subsets of artificial intelligence but there are many
similarities and differences between them.
Machine Learning Deep Learning
Apply statistical algorithms to learn the hidden Uses artificial neural network architecture
patterns and relationships in the dataset. to learn the hidden patterns and
relationships in the dataset.

Can work on the smaller amount of dataset Requires the larger volume of dataset
compared to machine learning

Better for the low-label task. Better for complex task like image
processing, natural language processing,
etc.

Takes less time to train the model. Takes more time to train the model.
A model is created by relevant features which Relevant features are automatically
are manually extracted from images to detect extracted from images. It is an end-to-end
an object in the image. learning process.

Less complex and easy to interpret the result. More complex, it works like the black box
interpretations of the result are not easy.

It can work on the CPU or requires less It requires a high-performance computer


computing power as compared to deep with GPU.
learning.

Types of neural networks


Deep Learning models are able to automatically learn features from the data, which makes
them well-suited for tasks such as image recognition, speech recognition, and natural language
processing. The most widely used architectures in deep learning are feedforward neural
networks, convolutional neural networks (CNNs), and recurrent neural networks (RNNs).
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
Feedforward neural networks (FNNs) are the simplest type of ANN, with a linear flow of
information through the network. FNNs have been widely used for tasks such as image
classification, speech recognition, and natural language processing.
Convolutional Neural Networks (CNNs) are specifically for image and video recognition tasks.
CNNs are able to automatically learn features from the images, which makes them well-suited
for tasks such as image classification, object detection, and image segmentation.
Recurrent Neural Networks (RNNs) are a type of neural network that is able to process
sequential data, such as time series and natural language. RNNs are able to maintain an internal
state that captures information about the previous inputs, which makes them well-suited for
tasks such as speech recognition, natural language processing, and language translation.
Applications of Deep Learning :
The main applications of deep learning can be divided into computer vision, natural language
processing (NLP), and reinforcement learning.
Computer vision
In computer vision, Deep learning models can enable machines to identify and understand
visual data. Some of the main applications of deep learning in computer vision include:
● Object detection and recognition: Deep learning model can be used to identify and
locate objects within images and videos, making it possible for machines to perform
tasks such as self-driving cars, surveillance, and robotics.
● Image classification: Deep learning models can be used to classify images into
categories such as animals, plants, and buildings. This is used in applications such as
medical imaging, quality control, and image retrieval.
● Image segmentation: Deep learning models can be used for image segmentation into
different regions, making it possible to identify specific features within images.
Natural language processing (NLP):
In NLP, the Deep learning model can enable machines to understand and generate human
language. Some of the main applications of deep learning in NLP include:
● Automatic Text Generation – Deep learning model can learn the corpus of text and
new text like summaries, essays can be automatically generated using these trained
models.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
● Language translation: Deep learning models can translate text from one language to

another, making it possible to communicate with people from different linguistic


backgrounds.
● Sentiment analysis: Deep learning models can analyze the sentiment of a piece of text,
making it possible to determine whether the text is positive, negative, or neutral. This
is used in applications such as customer service, social media monitoring, and political
analysis.
● Speech recognition: Deep learning models can recognize and transcribe spoken words,
making it possible to perform tasks such as speech-to-text conversion, voice search, and
voice-controlled devices.
Reinforcement learning:
In reinforcement learning, deep learning works as training agents to take action in an
environment to maximize a reward. Some of the main applications of deep learning in
reinforcement learning include:
● Game playing: Deep reinforcement learning models have been able to beat human
experts at games such as Go, Chess, and Atari.
● Robotics: Deep reinforcement learning models can be used to train robots to perform
complex tasks such as grasping objects, navigation, and manipulation.
● Control systems: Deep reinforcement learning models can be used to control complex
systems such as power grids, traffic management, and supply chain optimization.
Challenges in Deep Learning
Deep learning has made significant advancements in various fields, but there are still some
challenges that need to be addressed. Here are some of the main challenges in deep learning:
1. Data availability: It requires large amounts of data to learn from. For using deep
learning it’s a big concern to gather as much data for training.
2. Computational Resources: For training the deep learning model, it is computationally
expensive because it requires specialized hardware like GPUs and TPUs.
3. Time-consuming: While working on sequential data depending on the computational
resource it can take very large even in days or months.
4. Interpretability: Deep learning models are complex, it works like a black box. it is very
difficult to interpret the result.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
5. Overfitting: when the model is trained again and again, it becomes too specialized for
the training data, leading to overfitting and poor performance on new data.
Advantages of Deep Learning:
1. High accuracy: Deep Learning algorithms can achieve state-of-the-art performance in
various tasks, such as image recognition and natural language processing.
2. Automated feature engineering: Deep Learning algorithms can automatically discover
and learn relevant features from data without the need for manual feature engineering.
3. Scalability: Deep Learning models can scale to handle large and complex datasets, and
can learn from massive amounts of data.
4. Flexibility: Deep Learning models can be applied to a wide range of tasks and can
handle various types of data, such as images, text, and speech.
5. Continual improvement: Deep Learning models can continually improve their
performance as more data becomes available.
Disadvantages of Deep Learning:
1. High computational requirements: Deep Learning models require large amounts of data
and computational resources to train and optimize.
2. Requires large amounts of labeled data: Deep Learning models often require a large
amount of labeled data for training, which can be expensive and time- consuming to
acquire.
3. Interpretability: Deep Learning models can be challenging to interpret, making it
difficult to understand how they make decisions.
Overfitting: Deep Learning models can sometimes overfit to the training data, resulting
in poor performance on new and unseen data.
4. Black-box nature: Deep Learning models are often treated as black boxes, making it
difficult to understand how they work and how they arrived at their predictions. In
summary, while Deep Learning offers many advantages, including high accuracy and
scalability, it also has some disadvantages, such as high computational requirements,
the need for large amounts of labeled data, and interpretability challenges. These
limitations need to be carefully considered when deciding whether to use Deep
Learning for a specific task.
Backpropagation
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
Backpropagation is a widely used algorithm for training feedforward neural networks. It
computes the gradient of the loss function with respect to the network weights. It is very
efficient, rather than naively directly computing the gradient concerning each weight. This
efficiency makes it possible to use gradient methods to train multi-layer networks and update
weights to minimize loss; variants such as gradient descent or stochastic gradient descent are
often used.
The backpropagation algorithm works by computing the gradient of the loss function with
respect to each weight via the chain rule, computing the gradient layer by layer, and iterating
backward from the last layer to avoid redundant computation of intermediate terms in the chain
rule.
Features of Backpropagation:
1. it is the gradient descent method as used in the case of simple perceptron network with
the differentiable unit.
2. it is different from other networks in respect to the process by which the weights are
calculated during the learning period of the network.
3. training is done in the three stages :
● the feed-forward of input training pattern
● the calculation and backpropagation of the error
● updation of the weight Working of Backpropagation:
Neural networks use supervised learning to generate output vectors from input vectors that the
network operates on. It Compares generated output to the desired output and generates an error
report if the result does not match the generated output vector. Then it adjusts the weights
according to the bug report to get your desired output.
Backpropagation Algorithm:
Step 1: Inputs X, arrive through the preconnected path.
Step 2: The input is modeled using true weights W. Weights are usually chosen randomly.
Step 3: Calculate the output of each neuron from the input layer to the hidden layer to the
output layer.
Step 4: Calculate the error in the outputs
Backpropagation Error= Actual Output – Desired Output
Step 5: From the output layer, go back to the hidden layer to adjust the weights to reduce the
error.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
Step 6: Repeat the process until the desired output is achieved.

Parameters:
● x = inputs training vector x=(x1,x2,…………xn).
● t = target vector t=(t1,t2……………tn).
● δk = error at output unit.
● δj = error at hidden layer.
● α = learning rate.
● V0j = bias of hidden unit j.
Training Algorithm:
Step 1: Initialize weight to small random values.
Step 2: While the stepsstopping condition is to be false do step 3 to 10.
Step 3: For each training pair do step 4 to 9 (Feed-Forward).
Step 4: Each input unit receives the signal unit and transmitsthe signal xi signal to all the units.
Step 5 : Each hidden unit Zj (z=1 to a) sums its weighted input signal to calculate its net input
zinj = v0j + Σxivij ( i=1 to n)
Applying activation function zj = f(zinj) and sends this signals to all units in the layer
about i.e output units
For each output l=unit yk = (k=1 to m) sums its weighted input signals.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
yink = w0k + Σ ziwjk (j=1 to a) and applies its
activation function to calculate the output signals. yk =
f(yink)
Backpropagation Error:
Step 6: Each output unit yk (k=1 to n) receives a target pattern corresponding to an input pattern
then error is calculated as:
δk = ( tk – yk ) + yink
Step 7: Each hidden unit Zj (j=1 to a) sums its input from all units in the layer above
δinj = Σ δj wjk
The error information term is calculated as:
δj = δinj + zinj
Updation of weight and bias:
Step 8: Each output unit yk (k=1 to m) updates its bias and weight (j=1 to a). The weight
correction term is given by:
Δ wjk = α δk zj and the bias
correction term is given by Δwk = α δk.
therefore wjk(new) = wjk(old) + Δ wjk

w0k(new) = wok(old) + Δ wok

for each hidden unit zj (j=1 to a) update its bias and weights (i=0 to n) the weight
connection term
Δ vij = α δj xi
and the bias connection on term
Δ v0j = α δj
Therefore vij(new) = vij(old) + Δvij

v0j(new) = v0j(old) + Δv0j


Step 9: Test the stopping condition. The stopping condition can be the minimization of error,
number of epochs.
Need for Backpropagation:
Backpropagation is “backpropagation of errors” and is very useful for training neural networks.
It’s fast, easy to implement, and simple. Backpropagation does not require any parameters to
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
be set, except the number of inputs. Backpropagation is a flexible method because no prior
knowledge of the network is required.
Types of Backpropagation
There are two types of backpropagation networks.
● Static backpropagation: Static backpropagation is a network designed to map static
inputs for static outputs. These types of networks are capable of solving static
classification problems such as OCR (Optical Character Recognition).
● Recurrent backpropagation: Recursive backpropagation is another network used for
fixed-point learning. Activation in recurrent backpropagation is feed-forward until a
fixed value is reached. Static backpropagation provides an instant mapping, while
recurrent backpropagation does not provide an instant mapping.
Advantages:
● It is simple, fast, and easy to program.
● Only numbers of the input are tuned, not any other parameter.
● It is Flexible and efficient.
● No need for users to learn any special functions.
Disadvantages:
● It is sensitive to noisy data and irregularities. Noisy data can lead to inaccurate results.
● Performance is highly dependent on input data.
● Spending too much time training.
● The matrix-based approach is preferred over a mini-batch.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
Training Neural Networks Using Keras
Tensorflow was previously the most widely used Deep Learning library, however, it was
tricky to figure with for newbies. A simple one-layer network involves a substantial amount
of code. With Keras, however, the entire process of creating a Neural Network’s structure, as
well as training and tracking it, becomes exceedingly straightforward.
Keras is a high-level API that works with the backends Tensorflow, Theano, and CNTK. It
includes a good and user-friendly API for implementing neural network tests. It’s also capable
of running on both CPUs as well as GPUs.Keras comes with 10 different neural network
modelling and training API modules. Let’s take a look at a few of them one by one.
Keras Models
By adding and deleting layers, the Models API allows you to build complicated neural
networks. The model could be sequential, implying that the layers are piled one on top of the
other with a single input and output. The model can also be operational, meaning that it can
be completely changed.
A training module is also included in the API, with methods for generating the model, as well
as the optimizer and loss function, fitting the model, and evaluating and forecasting input
messages. It also provides methods for batch data training, testing, and forecasting. Models
API also allows you to save and preprocess your models.
What is Keras?
Tensorflow was previously the most widely used Deep Learning library, however, it was
tricky to figure with for newbies. A simple one-layer network involves a substantial amount
of code. With Keras, however, the entire process of creating a Neural Network’s structure, as
well as training and tracking it, becomes exceedingly straightforward.
Keras is a high-level API that works with the backends Tensorflow, Theano, and CNTK. It
includes a good and user-friendly API for implementing neural network tests. It’s also capable
of running on both CPUs as well as GPUs.Keras comes with 10 different neural network
modelling and training API modules. Let’s take a look at a few of them one by one.
Keras Models
By adding and deleting layers, the Models API allows you to build complicated neural
networks. The model could be sequential, implying that the layers are piled one on top of the
other with a single input and output. The model can also be operational, meaning that it can
be completely changed.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
A training module is also included in the API, with methods for generating the model, as well
as the optimizer and loss function, fitting the model, and evaluating and forecasting input
messages. It also provides methods for batch data training, testing, and forecasting. Models
API also allows you to save and preprocess your models.
1. Keras Sequential API
It allows us to develop models in a layer-by-layer fashion. However, it does not allow us to
create models with numerous inputs or outputs. It works well for simple layer stacks with
only one input and output tensor.
This paradigm fails when any of the layers in the stack have numerous inputs or outputs. Even
if we want non-linear topology, it isn’t suitable.

from keras.models import Sequential


from keras.layers import Dense
model=Sequential()
model.add(Dense(64,input_shape=4,))
mode.add(Dense(32) 2. Keras
functional API.
The Functional API can be used to create models with various inputs and outputs. It also
makes it possible for us to share these layers. In other words, we can use Keras’ functional API
to construct layer graphs.
Because a functional API is a data structure, it’s simple to save it as a single file that can be
used to rebuild the exact model without necessarily knowing the source code. From here, it’s
also straightforward to model the graph and access its nodes.
from keras.models import Model from
keras.layers import Input, Dense
input=Input(shape=(32,))
layer=Dense(32)(input)
model=Model(inputs=input,outputs=layer
)

Explaining Neural Network’s Various Layers


B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
Each and every neural network is founded on the basis of layers. The Layers API offers a
complete set of tools for building neural network architectures. The Layers API contains
methods for generating bespoke layers with custom weights and initializers in the Base Layer
class.
ann = models.Sequential([
layers.Flatten(input_shape=(32,32,3)),
layers.Dense(3000, activation='relu'),
layers.Dense(1000, activation='relu'), layers.Dense(10,
activation='softmax')
])
The Layer Activations class provides many activation functions such as ReLU, Sigmoid,
Tanh, Softmax, and so on. The Layer Weight Initializers class has methods for various weight
initializations.

cnn = models.Sequential([ layers.Conv2D(filters=32, kernel_size=(3, 3),


activation='relu', input_shape=(32, 32, 3)), layers.MaxPooling2D((2, 2)),

layers.Conv2D(filters=64, kernel_size=(3, 3), activation='relu'),


layers.MaxPooling2D((2, 2)),

layers.Flatten(), layers.Dense(64,
activation='relu'), layers.Dense(10,
activation='softmax')
])
It also offers the Core Layers class, which contains the classes required to generate core layers
such as Dense, Activation, and Embedding. Convolution Layers can be created in a variety of
ways using the Convolution Layer class. The Pooling Layers class contains the methods
required for Max Pooling, Average Pooling, Global Max Pooling, and Global Average
Pooling, as well as other types of pooling. Neural Network Callbacks
Callbacks are a way of tracking the model’s training. You can do a variety of activities before
or after an epoch or batch ends if Callback is enabled.
You can also utilise callbacks:
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
• Stopping after a specified number of epochs if the loss does not decrease significantly.
• While a model is being trained, you may see its internal states and statistics.

A callback is a type of object that can be used to accomplish tasks at different points of the
training process (i.e at the start /end of an epoch, before/after a single batch).
Callbacks can be used to:
To keep track of your measurements, keep TensorBoard logs after each batch of training.
Save your model to disc on a regular basis. Make an early stop.
During training, get a glimpse of a model’s internal states and statistics.

Preprocessing of Datasets
Data preprocessing is being defined as the procedure for preparing raw information for
machine learning/ deep learning models.
It is not always the norm that we come across clean and prepared data when working on a
machine learning project.
Real-world data sometimes contains noise, missing data, and is in an unsatisfactory format
that cannot be used effectively in machine learning models. Data preprocessing is an
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
extremely important/noteworthy job for cleaning data and making it suitable for machine
learning/ deep learning models, thus improving the model’s accuracy and efficiency. The data
is usually in raw format and structured in directories, and it must be preprocessed before it
can be supplied to the model for fitting. The Image Data Preprocessing class contains many
of these particular functions. The photo data, for example, must be an integer array, which may
be done with the img to array method. We may also use the image dataset from the directory
function if the images are in a directory and subfolders.
There are further classes for Time Series data and text data in the Data Preprocessing API.
Deep Learning Optimizers
The core of any neural network is the optimizer. In order to determine the appropriate
weights for prediction, each neural network optimises a loss function. There are several
different types of optimizers, each with a somewhat different technique to identifying the
optimal weights.
Optimizers are procedures or methodologies for minimising an error function as well as
increasing production efficiency. Optimizers are computational models that are built on the
learnable parameters of a model, such as Weights and Biases. Optimizers assist in determining
how to adjust the weights and learning rate of a neural network in order to minimise losses.
In layman’s terms, optimizers tinker with the weights to shape and mould your model into the
most accurate form possible. The loss function serves as a road map for the optimizer,
indicating whether it is travelling in the correct or wrong path.
Types of Optimizers:
1. Gradient Descent
2. Stochastic Gradient Descent.
3. Mini-Batch Gradient Descent.
4. Momentum Based Gradient Descent.
5. Nesterov Accelerated Gradient
6. Adagrad.
7. RMSProp

model.compile(
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
loss=‘categorical_crossentropy’,
optimizer=‘adam’,
metrics=[‘accuracy’]
)
Losses in Neural Network
Loss functions are required while compiling a model. This loss function would be optimised
by the optimizer, which was also specified as a parameter in the compilation procedure.
Probabilistic losses, regression losses, and hinge losses are the three types of losses. One of the
most key aspects of Neural Networks is the Loss Function. Loss is nothing more than a
Neural Net prediction error. Loss Function is the way for computing the loss. To put it another
way, the gradients are calculated using the Loss. Gradients are also utilised
to update the Neural Net’s weights.
Keras and Tensorflow have a variety of loss functions built-in for varied goals.
It’s a method of determining how effectively your algorithm models the data. Your loss
function will produce a greater value if your forecasts are completely wrong. If they’re
decent, it’ll give you a lower number. Your loss function will inform you if you’re making
progress as you tweak parts of your algorithm to try to enhance your model.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025

source: algorithmia Evaluation


Metrics To assess its
performance on test data,
every Machine Learning
model use metrics. Metrics are
similar to Loss Functions,
except they are used to
monitor test data. Accuracy,
Binary Accuracy, Categorical
Accuracy, and other forms of
accuracy measures exist.
Probabilistic measures such as
binary cross-entropy,
categorical cross-entropy, and
others are also provided. It also
consists of regression metrics
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
such as Root Mean Squared
Error, Means Absolute Error,
Means Squared Error etc
Different kinds of evaluation metrics available are as follows
1. Classification Accuracy
2. Confusion Matrix
3. Area under Curve
4. Logarithmic Loss
5. Mean Squared Error
6. F1 Score
7. Mean Absolute Error
Applications for Keras
The Keras Applications class contains various prebuilt models as well as weights that have
already been trained. In the Transfer Learning process, these pre-trained models are used. The
architecture, number of layers, trainable weights, and other parameters of these pre-trained
models vary. VGG16, Xception, Resnet50, MobileNet, and others are among them. Pre-
Trained Deep Learning Models
Model Architecture and model Weights are the aspects of a trained model. Because model
weights are a huge file, we must download and retrieve them from the ImageNet database.
The Keras applications module is used to deploy deep neural network models that have already
been trained. Keras models are used for feature extraction, prediction, and fine-tuning.

Loading a model(pre-trained)
import keras import numpy
as np

from keras.applications import vgg16, inception_v3, resnet50, mobilenet

#Load the VGG model vgg_model =


vgg16.VGG16(weights = 'imagenet') #Load the
Inception_V3 model inception_model =
inception_v3.InceptionV3(weights = 'imagenet')
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025

#Load the ResNet50 model resnet_model =


resnet50.ResNet50(weights = 'imagenet')

#Load the MobileNet model mobilenet_model = mobilenet.MobileNet(weights = 'imagenet')


Using Keras to Train Neural Networks

Let us Consider the MNIST dataset, which is included in Keras’ datasets class. For categorising
handwritten images of digits 0-9, we’ll build a basic sequential Convolutional Neural Network.
from keras.preprocessing.image import ImageDataGenerator
datagen = ImageDataGenerator( rotation_range=10,
zoom_range=0.1, width_shift_range=0.1,
height_shift_range=0.1
)
epochs = 10
batch_size = 32 history = model.fit_generator(datagen.flow(x_train, y_train,
batch_size=batch_size), epochs=epochs, validation_data=(x_test, y_test),
steps_per_epoch=x_train.shape[0]//batch_size
)
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
output:
Epoch 1/10
1563/1563 [==============================] - 55s 33ms/step - loss: 1.6791 -
accuracy: 0.3891
Epoch 2/10
1563/1563 [==============================] - 63s 40ms/step - loss: 1.1319 -
accuracy: 0.60360s - loss:
Epoch 3/10
1563/1563 [==============================] - 66s 42ms/step - loss: 0.9915 -
accuracy: 0.6533
Epoch 4/10
1563/1563 [==============================] - 70s 45ms/step - loss: 0.8963 -
accuracy: 0.6883
Epoch 5/10
1563/1563 [==============================] - 69s 44ms/step - loss: 0.8192 -
accuracy: 0.7159
Epoch 6/10
1563/1563 [==============================] - 62s 39ms/step - loss: 0.7695 -
accuracy: 0.73471s
Epoch 7/10
1563/1563 [==============================] - 62s 39ms/step - loss: 0.7071 -
accuracy: 0.7542
Epoch 8/10
1563/1563 [==============================] - 62s 40ms/step - loss: 0.6637 -
accuracy: 0.76941s - l
Epoch 9/10
1563/1563 [==============================] - 60s 38ms/step - loss: 0.6234 -
accuracy: 0.7840
Epoch 10/10
1563/1563 [==============================] - 58s 37ms/step - loss: 0.5810 -
accuracy: 0.7979
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
Regularization
Before we deep dive into the topic, take a look at this image:

Have you seen this image before? As we move towards the right in this image, our model tries
to learn too well the details and the noise from the training data, which ultimately results in
poor performance on the unseen data.
In other words, while going towards the right, the complexity of the model increases such that
the training error reduces but the testing error doesn’t. This is shown in the image below.

If you’ve built a neural network before, you know how complex they are. This makes them
more prone to overfitting.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
Regularization is a technique which makes slight modifications to the learning algorithm such
that the model generalizes better. This in turn improves the model’s performance on the unseen
data as well.
How does Regularization help reduce Overfitting?
Let’s consider a neural network which is overfitting on the training data.

If you have studied the concept of regularization in machine learning, you will have a fair idea
that regularization penalizes the coefficients. In deep learning, it actually penalizes the
weight matrices of the nodes.
Assume that our regularization coefficient is so high that some of the weight matrices are nearly
equal to zero. This will result in a much simpler linear network and slight underfitting of the
training data.
Such a large value of the regularization coefficient is not that useful. We need to optimize the
value of regularization coefficient in order to obtain a well-fitted model as shown in the image
below.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025

Different Regularization Techniques in Deep Learning


Now that we have an understanding of how regularization helps in reducing overfitting, we’ll
learn a few different techniques in order to apply regularization in deep learning.
L2 & L1 regularization
L1 and L2 are the most common types of regularization. These update the general cost function
by adding another term known as the regularization term.
Cost function = Loss (say, binary cross entropy) + Regularization term
Due to the addition of this regularization term, the values of weight matrices decrease because
it assumes that a neural network with smaller weight matrices leads to simpler models.
Therefore, it will also reduce overfitting to quite an extent.
However, this regularization term differs in L1 and L2.

In L2, we have:
Here, lambda is the regularization parameter. It is the hyperparameter whose value is
optimized for better results. L2 regularization is also known as weight decay as it forces the
weights to decay towards zero (but not exactly zero).
In L1, we have:

In this, we penalize the absolute value of the weights. Unlike L2, the weights may be reduced
to zero here. Hence, it is very useful when we are trying to compress our model. Otherwise,
we usually prefer L2 over it.
Dropout
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
This is the one of the most interesting types of regularization techniques. It also produces very
good results and is consequently the most frequently used regularization technique in the field
of deep learning.
To understand dropout, let’s say our neural network structure is akin to the one shown below:

So what does dropout do? At every iteration, it randomly selects some nodes and removes them
along with all of their incoming and outgoing connections as shown below.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
So each iteration has a different set of nodes and this results in a different set of outputs. It can
also be thought of as an ensemble technique in machine learning.
Ensemble models usually perform better than a single model as they capture more randomness.
Similarly, dropout also performs better than a normal neural network model.
This probability of choosing how many nodes should be dropped is the hyperparameter of the
dropout function. As seen in the image above, dropout can be applied to both the hidden layers
as well as the input layers.

Due to these reasons, dropout is usually preferred when we have a large neural network
structure in order to introduce more randomness.
In keras, we can implement dropout using the keras layer. Below is the Dropout
Implementation. I have introduced a dropout of 0.2 as the probability of dropping in my neural
network architecture after the last hidden layer having 64 kernels and after the first dense layer
having 500 neurons. Batch Normalization
Generally, when we input the data to a machine or deep learning algorithm we tend to change
the values to a balanced scale. The reason we normalize is partly to ensure that our model
can generalize appropriately.
Now coming back to Batch normalization, it is a process to make neural networks faster and
more stable through adding extra layers in a deep neural network. The new layer performs the
standardizing and normalizing operations on the input of a layer coming from a previous layer.
But what is the reason behind the term “Batch” in batch normalization? A typical neural
network is trained using a collected set of input data called batch. Similarly, the normalizing
process in batch normalization takes place in batches, not as a single input.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
Normalization of the Input
Normalization is the process of transforming the data to have a mean zero and standard
deviation one. In this step we have our batch input from layer h, first, we need to calculate the
mean of this hidden activation.

Here, m is the number of neurons at layer h.


Once we have meant at our end, the next step is to calculate the standard deviation of the hidden
activations.

Further, as we have the mean and the standard deviation ready. We will normalize the hidden
activations using these values. For this, we will subtract the mean from each input and divide
the whole value with the sum of standard deviation and the smoothing term (ε).
The smoothing term(ε) assures numerical stability within the operation by stopping a division
by a zero value.

Rescaling of Offsetting
In the final operation, the re-scaling and offsetting of the input take place. Here two components
of the BN algorithm come into the picture, γ(gamma) and β (beta). These parameters are used
for re-scaling (γ) and shifting(β) of the vector containing values from the previous operations.

These two are learnable parameters, during the training neural network ensures the optimal
values of γ and β are used. That will enable the accurate normalization of each batch.
Advantages of Batch Normalization
Now let’s look into the advantages the BN process offers.
Speed Up the Training
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
By Normalizing the hidden layer activation the Batch normalization speeds up the training
process.
Handles internal covariate shift
It solves the problem of internal covariate shift. Through this, we ensure that the input for every
layer is distributed around the same mean and standard deviation. If you are unaware of what
is an internal covariate shift, look at the following example.
Internal covariate shift
Suppose we are training an image classification model, that classifies the images into Dog or
Not Dog. Let’s say we have the images of white dogs only, these images will have certain
distribution as well. Using these images model will update its parameters.

later, if we get a new set of images, consisting of non-white dogs. These new images will have
a slightly different distribution from the previous images. Now the model will change its
parameters according to these new images. Hence the distribution of the hidden activation will
also change. This change in hidden activation is known as an internal covariate shift.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
Introduction to Convolution Neural Network
A Convolutional Neural Network (CNN) is a type of Deep Learning neural network
architecture commonly used in Computer Vision. Computer vision is a field of Artificial
Intelligence that enables a computer to understand and interpret the image or visual data.
When it comes to Machine Learning, Artificial Neural Networks perform really well. Neural
Networks are used in various datasets like images, audio, and text. Different types of Neural
Networks are used for different purposes, for example for predicting the sequence of words we
use Recurrent Neural Networks more precisely an LSTM, similarly for image classification
we use Convolution Neural networks. In this blog, we are going to build a basic building block
for CNN.
In a regular Neural Network there are three types of layers:
1. Input Layers: It’s the layer in which we give input to our model. The number of
neurons in this layer is equal to the total number of features in our data (number of
pixels in the case of an image).
2. Hidden Layer: The input from the Input layer is then fed into the hidden layer. There
can be many hidden layers depending on our model and data size. Each hidden layer
can have different numbers of neurons which are generally greater than the number of
features. The output from each layer is computed by matrix multiplication of the output
of the previous layer with learnable weights of that layer and then by the addition of
learnable biases followed by activation function which makes the network nonlinear.
3. Output Layer: The output from the hidden layer is then fed into a logistic function like
sigmoid or softmax which converts the output of each class into the probability score
of each class.
The data is fed into the model and output from each layer is obtained from the above step is
called feedforward, we then calculate the error using an error function, some common error
functions are cross-entropy, square loss error, etc. The error function measures how well the
network is performing. After that, we backpropagate into the model by calculating the
derivatives. This step is called Backpropagation which basically is used to minimize the loss.
Convolution Neural Network
Convolutional Neural Network (CNN) is the extended version of artificial neural networks
(ANN) which is predominantly used to extract the feature from the grid-like matrix dataset.
For example, visual datasets like images or videos where data patterns play an extensive role.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
CNN architecture
Convolutional Neural Network consists of multiple layers like the input layer, Convolutional
layer, Pooling layer, and fully connected layers.

Simple CNN architecture


The Convolutional layer applies filters to the input image to extract features, the Pooling layer
downsamples the image to reduce computation, and the fully connected layer makes the final
prediction. The network learns the optimal filters through backpropagation and gradient
descent.
How Convolutional Layers works
Convolution Neural Networks or covnets are neural networks that share their parameters.
Imagine you have an image. It can be represented as a cuboid having its length, width
(dimension of the image), and height (i.e the channel as images generally have red, green, and
blue channels).

Now imagine taking a small patch of this image and running a small neural network, called a
filter or kernel on it, with say, K outputs and representing them vertically. Now slide that neural
network across the whole image, as a result, we will get another image with different widths,
heights, and depths. Instead of just R, G, and B channels now we have more channels but lesser
width and height. This operation is called Convolution. If the patch size is the same as that of
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
the image it will be a regular neural network. Because of this small patch, we have fewer
weights.

Now let’s talk about a bit of mathematics that is involved in the whole convolution process.
● Convolution layers consist of a set of learnable filters (or kernels) having small widths
and heights and the same depth as that of input volume (3 if the input layer is image
input).
● For example, if we have to run convolution on an image with dimensions 34x34x3. The
possible size of filters can be axax3, where ‘a’ can be anything like 3, 5, or 7 but smaller
as compared to the image dimension.
● During the forward pass, we slide each filter across the whole input volume step by step
where each step is called stride (which can have a value of 2, 3, or even 4 for
highdimensional images) and compute the dot product between the kernel weights and
patch from input volume.
● As we slide our filters we’ll get a 2-D output for each filter and we’ll stack them together
as a result, we’ll get output volume having a depth equal to the number of filters. The
network will learn all the filters.
Layers used to build ConvNets
A complete Convolution Neural Networks architecture is also known as covnets. A covnets is
a sequence of layers, and every layer transforms one volume to another through a differentiable
function.
Types of layers:
Datasets, Let’s take an example by running a covnets on of image of dimension 32 x 32 x 3.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
● Input Layers: It’s the layer in which we give input to our model. In CNN, Generally,

the input will be an image or a sequence of images. This layer holds the raw input of
the image with width 32, height 32, and depth 3.
● Convolutional Layers: This is the layer, which is used to extract the feature from the
input dataset. It applies a set of learnable filters known as the kernels to the input
images. The filters/kernels are smaller matrices usually 2×2, 3×3, or 5×5 shape. it slides
over the input image data and computes the dot product between kernel weight and the
corresponding input image patch. The output of this layer is referred ad feature maps.
Suppose we use a total of 12 filters for this layer we’ll get an output volume of
dimension 32 x 32 x 12.
● Activation Layer: By adding an activation function to the output of the preceding
layer, activation layers add nonlinearity to the network. It will apply an element-wise
activation function to the output of the convolution layer. Some common activation
functions are RELU: max(0, x), Tanh, Leaky RELU, etc. The volume remains
unchanged hence output volume will have dimensions 32 x 32 x 12.
● Pooling layer: This layer is periodically inserted in the covnets and its main function
is to reduce the size of volume which makes the computation fast reduces memory and
also prevents overfitting. Two common types of pooling layers are max pooling and
average pooling. If we use a max pool with 2 x 2 filters and stride 2, the resultant
volume will be of dimension 16x16x12.

● Flattening: The resulting feature maps are flattened into a one-dimensional vector after
the convolution and pooling layers so they can be passed into a completely linked layer
for categorization or regression.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
● Fully Connected Layers: It takes the input from the previous layer and computes the

final classification or regression task.

● Output Layer: The output from the fully connected layers is then fed into a logistic
function for classification tasks like sigmoid or softmax which converts the output of
each class into the probability score of each class.
Introduction to Natural Language Processing
Natural language processing (NLP) is a subfield of Artificial Intelligence (AI). This is a widely
used technology for personal assistants that are used in various business fields/areas. This
technology works on the speech provided by the user breaks it down for proper understanding
and processes it accordingly. This is a very recent and effective approach due to which it has a
really high demand in today’s market. Natural Language Processing is an upcoming field where
already many transitions such as compatibility with smart devices, and interactive talks with a
human have been made possible. Knowledge representation, logical reasoning, and constraint
satisfaction were the emphasis of AI applications in NLP. Here first it was applied to semantics
and later to grammar. In the last decade, a significant change in NLP research has resulted in
the widespread use of statistical approaches such as machine learning and data mining on a
massive scale. The need for automation is never-ending courtesy of the amount of work
required to be done these days. NLP is a very favourable, but aspect when it comes to
automated applications. The applications of NLP have led it to be one of the most sought-after
methods of implementing machine learning. Natural Language Processing (NLP) is a field that
combines computer science, linguistics, and machine learning to study how computers and
humans communicate in natural language. The goal of NLP is for computers to be able to
interpret and generate human language. This not only improves the efficiency of work done by
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2024-2025
humans but also helps in interacting with the machine. NLP bridges the gap of interaction
between humans and electronic devices.
Natural Language Processing (NLP) is a subfield of artificial intelligence that deals with the
interaction between computers and humans in natural language. It involves the use of
computational techniques to process and analyze natural language data, such as text and
speech, with the goal of understanding the meaning behind the language.
NLP is used in a wide range of applications, including machine translation, sentiment analysis,
speech recognition, chatbots, and text classification. Some common techniques used in NLP
include:
1. Tokenization: the process of breaking text into individual words or phrases.
2. Part-of-speech tagging: the process of labeling each word in a sentence with its
grammatical part of speech.
3. Named entity recognition: the process of identifying and categorizing named entities,
such as people, places, and organizations, in text.
4. Sentiment analysis: the process of determining the sentiment of a piece of text, such as
whether it is positive, negative, or neutral.
5. Machine translation: the process of automatically translating text from one language to
another.
6. Text classification: the process of categorizing text into predefined categories or topics.
Recent advances in deep learning, particularly in the area of neural networks, have led
to significant improvements in the performance of NLP systems. Deep learning
techniques such as Convolutional Neural Networks (CNNs) and Recurrent Neural
Networks (RNNs) have been applied to tasks such as sentiment analysis and machine
translation, achieving state-of-the-art results.
Overall, NLP is a rapidly evolving field that has the potential to revolutionize the way we
interact with computers and the world around us.
Natural Language Processing
Natural Language Processing (NLP) is a field of Artificial Intelligence (AI) and Computer
Science that is concerned with the interactions between computers and humans in natural
language. The goal of NLP is to develop algorithms and models that enable computers to
understand, interpret, generate, and manipulate human languages.
Common Natural Language Processing (NLP) Task:
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2023-2024

Text and speech processing: This includes Speech recognition, text-&-speech


processing, encoding (i.e converting speech or text to machine-readable language), etc.
• Text classification: This includes Sentiment Analysis in which the machine can
analyze the qualities, emotions, and sarcasm from text and also classify it accordingly.
• Language generation: This includes tasks such as machine translation, summary
writing, essay writing, etc. which aim to produce coherent and fluent text.
• Language interaction: This includes tasks such as dialogue systems, voice assistants,
and chatbots, which aim to enable natural communication between humans and
computers.
NLP techniques are widely used in a variety of applications such as search engines, machine
translation, sentiment analysis, text summarization, question answering, and many more. NLP
research is an active field and recent advancements in deep learning have led to significant
improvements in NLP performance. However, NLP is still a challenging field as it requires an
understanding of both computational and linguistic principles.
Working of Natural Language Processing (NLP)
Working in natural language processing (NLP) typically involves using computational
techniques to analyze and understand human language. This can include tasks such as
language understanding, language generation, and language interaction.
The field is divided into three different parts:
1. Speech Recognition — The translation of spoken language into text.
2. Natural Language Understanding (NLU) — The computer’s ability to understand what
we say.
3. Natural Language Generation (NLG) — The generation of natural language by a
computer.
NLU and NLG are the key aspects depicting the working of NLP devices. These 2 aspects are
very different from each other and are achieved using different methods.
Individuals working in NLP may have a background in computer science, linguistics, or a
related field. They may also have experience with programming languages such as Python,
and C++ and be familiar with various NLP libraries and frameworks such as NLTK, spaCy,
and OpenNLP.
Speech Recognition:
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2023-2024

First, the computer must take natural language and convert it into machine-readable
language. This is what speech recognition or speech-to-text does. This is the first step
of NLU.
• Hidden Markov Models (HMMs) are used in the majority of voice recognition systems
nowadays. These are statistical models that use mathematical calculations to determine
what you said in order to convert your speech to text.
• HMMs do this by listening to you talk, breaking it down into small units (typically
1020 milliseconds), and comparing it to pre-recorded speech to figure out which
phoneme you uttered in each unit (a phoneme is the smallest unit of speech). The
program then examines the sequence of phonemes and uses statistical analysis to
determine the most likely words and sentences you were speaking.
Natural Language Understanding (NLU):
The next and hardest step of NLP is the understanding part.
• First, the computer must comprehend the meaning of each word. It tries to figure out
whether the word is a noun or a verb, whether it’s in the past or present tense, and so
on. This is called Part-of-Speech tagging (POS).
• A lexicon (a vocabulary) and a set of grammatical rules are also built into NLP systems.
The most difficult part of NLP is understanding.
• The machine should be able to grasp what you said by the conclusion of the process.
There are several challenges in accomplishing this when considering problems such as
words having several meanings (polysemy) or different words having similar meanings
(synonymy), but developers encode rules into their NLU systems and train them to
learn to apply the rules correctly.
Natural Language Generation (NLG):
NLG is much simpler to accomplish. NLG converts a computer’s machine-readable language
into text and can also convert that text into audible speech using text-to-speech technology.
• First, the NLP system identifies what data should be converted to text. If you asked the
computer a question about the weather, it most likely did an online search to find your
answer, and from there it decides that the temperature, wind, and humidity are the
factors that should be read aloud to you.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2023-2024

• Then, it organizes the structure of how it’s going to say it. This is similar to NLU except
backward. NLG system can construct full sentences using a lexicon and a set of
grammar rules.
Finally, text-to-speech takes over. The text-to-speech engine uses a prosody model to
evaluate the text and identify breaks, duration, and pitch. The engine then combines all
the recorded phonemes into one cohesive string of speech using a speech database.
Some common roles in Natural Language Processing (NLP) include:
• NLP engineer: designing and implementing NLP systems and models
• NLP researcher: conducting research on NLP techniques and algorithms
• ML engineer: Designing and deployment of various machine learning models
including NLP.
• NLP data scientist: analyzing and interpreting NLP data
• NLP consultant: providing expertise in NLP to organizations and businesses. Working
in NLP can be both challenging and rewarding as it requires a good understanding of
both computational and linguistic principles. NLP is a fast-paced and rapidly changing
field, so it is important for individuals working in NLP to stay up-to-date with the latest
developments and advancements.
Technologies related to Natural Language Processing
There are a variety of technologies related to natural language processing (NLP) that are used
to analyze and understand human language. Some of the most common include:
1. Machine learning: NLP relies heavily on machine learning techniques such as
supervised and unsupervised learning, deep learning, and reinforcement learning to
train models to understand and generate human language.
2. Natural Language Toolkits (NLTK) and other libraries: NLTK is a popular
opensource library in Python that provides tools for NLP tasks such as tokenization,
stemming, and part-of-speech tagging. Other popular libraries include spaCy,
OpenNLP, and CoreNLP.
3. Parsers: Parsers are used to analyze the syntactic structure of sentences, such as
dependency parsing and constituency parsing.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2023-2024

4. Text-to-Speech (TTS) and Speech-to-Text (STT) systems: TTS systems convert


written text into spoken words, while STT systems convert spoken words into written
text.
5. Named Entity Recognition (NER) systems: NER systems identify and extract named
entities such as people, places, and organizations from the text.
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2023-2024
6. Sentiment Analysis: A technique to understand the emotions or opinions expressed in
a piece of text, by using various techniques like Lexicon-Based, Machine
LearningBased, and Deep Learning-based methods
7. Machine Translation: NLP is used for language translation from one language to
another through a computer.
8. Chatbots: NLP is used for chatbots that communicate with other chatbots or humans
through auditory or textual methods.
9. AI Software: NLP is used in question-answering software for knowledge
representation, analytical reasoning as well as information retrieval.
Applications of Natural Language Processing (NLP):
• Spam Filters: One of the most irritating things about email is spam. Gmail uses natural
language processing (NLP) to discern which emails are legitimate and which are spam.
These spam filters look at the text in all the emails you receive and try to figure out
what it means to see if it’s spam or not.
• Algorithmic Trading: Algorithmic trading is used for predicting stock market
conditions. Using NLP, this technology examines news headlines about companies and
stocks and attempts to comprehend their meaning in order to determine if you should
buy, sell, or hold certain stocks.
• Questions Answering: NLP can be seen in action by using Google Search or Siri
Services. A major use of NLP is to make search engines understand the meaning of
what we are asking and generate natural language in return to give us the answers.
• Summarizing Information: On the internet, there is a lot of information, and a lot of
it comes in the form of long documents or articles. NLP is used to decipher the meaning
of the data and then provides shorter summaries of the data so that humans can
comprehend it more quickly.
Future Scope:
• Bots: Chatbots assist clients to get to the point quickly by answering inquiries and
referring them to relevant resources and products at any time of day or night. To be
effective, chatbots must be fast, smart, and easy to use, To accomplish this, chatbots
employ NLP to understand language, usually over text or voice-recognition
interactions Supporting Invisible UI: Almost every connection we have with
machines involves human communication, both spoken and written. Amazon’s Echo
B.Tech CSE AIML, 5th Semester
Artificial Intelligence for Real World Application
(PCC-CSM 503)
2023-2024
is only one illustration of the trend toward putting humans in closer contact with
technology in the future. The concept of an invisible or zero user interface will rely on
direct communication between the user and the machine, whether by voice, text, or a
combination of the two. NLP helps to make this concept a real-world thing.
• Smarter Search: NLP’s future also includes improved search, something we’ve been
discussing at Expert System for a long time. Smarter search allows a chatbot to
understand a customer’s request can enable “search like you talk” functionality (much
like you could query Siri) rather than focusing on keywords or topics. Google recently
announced that NLP capabilities have been added to Google Drive, allowing users to
search for documents and content using natural language.
Future Enhancements:
• Companies like Google are experimenting with Deep Neural Networks (DNNs) to
push the limits of NLP and make it possible for human-to-machine interactions to feel
just like human-to-human interactions.
• Basic words can be further subdivided into proper semantics and used in NLP
algorithms.
• The NLP algorithms can be used in various languages that are currently unavailable
such as regional languages or languages spoken in rural areas etc.
• Translation of a sentence in one language to the same sentence in another Language at
a broader scope.

You might also like