[go: up one dir, main page]

0% found this document useful (0 votes)
107 views27 pages

Unit 4

Deep learning is a form of machine learning using deep neural networks. It mimics the network of neurons in the brain and can perform supervised, semi-supervised, or unsupervised learning. Deep learning algorithms use connected layers of neurons - an input layer, output layer, and multiple hidden layers. Information flows through the network, with each layer learning increasingly complex features. Deep learning is used for tasks like object detection, speech recognition, and can learn automatically from large amounts of data without being explicitly programmed.

Uploaded by

6644 Haripriya
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)
107 views27 pages

Unit 4

Deep learning is a form of machine learning using deep neural networks. It mimics the network of neurons in the brain and can perform supervised, semi-supervised, or unsupervised learning. Deep learning algorithms use connected layers of neurons - an input layer, output layer, and multiple hidden layers. Information flows through the network, with each layer learning increasingly complex features. Deep learning is used for tasks like object detection, speech recognition, and can learn automatically from large amounts of data without being explicitly programmed.

Uploaded by

6644 Haripriya
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/ 27

UNIT-4

Deep Learning Neural networks

What is Deep Learning?

Deep Learning is a computer software that mimics the network of neurons in a brain. It is a subset
of machine learning based on artificial neural networks with representation learning. It is called
deep learning because it makes use of deep neural networks. This learning can be supervised, semi-
supervised or unsupervised.

Deep learning algorithms are constructed with connected layers.

• The first layer is called the Input Layer


• The last layer is called the Output Layer
• All layers in between are called Hidden Layers. The word deep means the network join
neurons in more than two layers.
Each Hidden layer is composed of neurons. The neurons are connected to each other. The neuron
will process and then propagate the input signal it receives the layer above it. The strength of the
signal given the neuron in the next layer depends on the weight, bias and activation function.

The network consumes large amounts of input data and operates them through multiple layers; the
network can learn increasingly complex features of the data at each layer.

Deep learning Process

A deep neural network provides state-of-the-art accuracy in many tasks, from object detection to
speech recognition. They can learn automatically, without predefined knowledge explicitly coded
by the programmers

To grasp the idea of deep learning, imagine a family, with an infant and parents. The toddler points
objects with his little finger and always says the word ‘cat.’ As his parents are concerned about his
education, they keep telling him ‘Yes, that is a cat’ or ‘No, that is not a cat.’ The infant persists in
pointing objects but becomes more accurate with ‘cats.’ The little kid, deep down, does not know
why he can say it is a cat or not. He has just learned how to hierarchies’ complex features coming
up with a cat by looking at the pet overall and continue to focus on details such as the tails or the
nose before to make up his mind.

A neural network works quite the same. Each layer represents a deeper level of knowledge, i.e.,
the hierarchy of knowledge. A neural network with four layers will learn more complex feature
than with two layers.

The learning occurs in two phases:

First Phase: The first phase consists of applying a nonlinear transformation of the input and
create a statistical model as output.
Second Phase: The second phase aims at improving the model with a mathematical method
known as derivative.

The neural network repeats these two phases’ hundreds to thousands of times until it has reached
a tolerable level of accuracy. The repeat of this two-phase is called an iteration.

To give a Deep learning example, take a look at the motion below, the model is trying to learn
how to dance. After 10 minutes of training, the model does not know how to dance, and it looks
like a scribble.

After 48 hours of learning, the computer masters the art of dancing.


Classification of Neural Networks

Shallow neural network: The Shallow neural network has only one hidden layer between the
input and output.

Deep neural network: Deep neural networks have more than one layer. For instance, Google
LeNet model for image recognition counts 22 layers.

Nowadays, deep learning is used in many ways like a driverless car, mobile phone, Google
Search Engine, Fraud detection, TV, and so on.

Types of Deep Learning Networks

Now in this Deep Neural network tutorial, we will learn about types of Deep Learning Networks:
Feed-forward neural networks

The simplest type of artificial neural network. With this type of architecture, information flows in
only one direction, forward. It means, the information’s flows starts at the input layer, goes to the
“hidden” layers, and end at the output layer. The network

does not have a loop. Information stops at the output layers.

Recurrent neural networks (RNNs)

RNN is a multi-layered neural network that can store information in context nodes, allowing it to
learn data sequences and output a number or another sequence. In simple words, it is an Artificial
neural network whose connections between neurons include loops. RNNs are well suited for
processing sequences of inputs.
For Example, if the task is to predict the next word in the sentence “Do you want a…………?

• The RNN neurons will receive a signal that point to the start of the sentence.
• The network receives the word “Do” as an input and produces a vector of the number.
This vector is fed back to the neuron to provide a memory to the network. This stage
helps the network to remember it received “Do” and it received it in the first position.
• The network will similarly proceed to the next words. It takes the word “you” and
“want.” The state of the neurons is updated upon receiving each word.
• The final stage occurs after receiving the word “a.” The neural network will provide a
probability for each English word that can be used to complete the sentence. A well-
trained RNN probably assigns a high probability to “café,” “drink,” “burger,” etc.

Common uses of RNN

• Help securities traders to generate analytic reports


• Detect abnormalities in the contract of financial statement
• Detect fraudulent credit-card transaction
• Provide a caption for images
• Power chatbots
• The standard uses of RNN occur when the practitioners are working with time-series data
or sequences (e.g., audio recordings or text).

Convolutional neural networks (CNN)


CNN is a multi-layered neural network with a unique architecture designed to extract
increasingly complex features of the data at each layer to determine the output. CNN’s are well
suited for perceptual tasks.

CNN is mostly used when there is an unstructured data set (e.g., images) and the practitioners
need to extract information from it.

For instance, if the task is to predict an image caption:

• The CNN receives an image of let’s say a cat, this image, in computer term, is a
collection of the pixel. Generally, one layer for the greyscale picture and three layers for
a color picture.
• During the feature learning (i.e., hidden layers), the network will identify unique features,
for instance, the tail of the cat, the ear, etc.
• When the network thoroughly learned how to recognize a picture, it can provide a
probability for each image it knows. The label with the highest probability will become
the prediction of the network.

Reinforcement Learning

Reinforcement learning is a subfield of machine learning in which systems are trained by receiving
virtual “rewards” or “punishments,” essentially learning by trial and error. Google’s DeepMind
has used reinforcement learning to beat a human champion in the Go games. Reinforcement
learning is also used in video games to improve the gaming experience by providing smarter bots.
One of the most famous algorithms are:

• Q-learning
• Deep Q network
• State-Action-Reward-State-Action (SARSA)
• Deep Deterministic Policy Gradient (DDPG)

Examples of deep learning applications

Now in this Deep learning for beginners tutorial, let’s learn about Deep Learning applications:

AI in Finance:

The financial technology sector has already started using AI to save time, reduce costs, and add
value. Deep learning is changing the lending industry by using more robust credit scoring. Credit
decision-makers can use AI for robust credit lending applications to achieve faster, more accurate
risk assessment, using machine intelligence to factor in the character and capacity of applicants.

Underwrite is a Fintech company providing an AI solution for credit makers companies.


underwrite.ai uses AI to detect which applicant is more likely to pay back a loan. Their approach
radically outperforms traditional methods.

AI in HR:

Under Armour, a sportswear company revolutionizes hiring and modernizes the candidate
experience with the help of AI. In fact, Under Armour Reduces hiring time for its retail stores by
35%. Under Armour faced a growing popularity interest back in 2012. They had, on average,
30000 resumes a month. Reading all of those applications and begin to start the screening and
interview process was taking too long. The lengthy process to get people hired and on-boarded
impacted Under Armour’s ability to have their retail stores fully staffed, ramped and ready to
operate.

At that time, Under Armour had all of the ‘must have’ HR technology in place such as transactional
solutions for sourcing, applying, tracking and onboarding but those tools weren’t useful enough.
Under armour choose HireVue, an AI provider for HR solution, for both on-demand and live
interviews. The results were bluffing; they managed to decrease by 35% the time to fill. In return,
the hired higher quality staffs.

AI in Marketing:

AI is a valuable tool for customer service management and personalization challenges. Improved
speech recognition in call-center management and call routing as a result of the application of AI
techniques allows a more seamless experience for customers.

For example, deep-learning analysis of audio allows systems to assess a customer’s emotional
tone. If the customer is responding poorly to the AI chatbot, the system can be rerouted the
conversation to real, human operators that take over the issue.

Apart from the three Deep learning examples above, AI is widely used in other
sectors/industries.

Why is Deep Learning Important?

Deep learning is a powerful tool to make prediction an actionable result. Deep learning excels in
pattern discovery (unsupervised learning) and knowledge-based prediction. Big data is the fuel for
deep learning. When both are combined, an organization can reap unprecedented results in term
of productivity, sales, management, and innovation.

Deep learning can outperform traditional method. For instance, deep learning algorithms are 41%
more accurate than machine learning algorithm in image classification, 27 % more accurate in
facial recognition and 25% in voice recognition.

Limitations of deep learning

Now in this Neural network tutorial, we will learn about limitations of Deep Learning:

Data labeling

Most current AI models are trained through “supervised learning.” It means that humans must
label and categorize the underlying data, which can be a sizable and error-prone chore. For
example, companies developing self-driving-car technologies are hiring hundreds of people to
manually annotate hours of video feeds from prototype vehicles to help train these systems.

Obtain huge training datasets

It has been shown that simple deep learning techniques like CNN can, in some cases, imitate the
knowledge of experts in medicine and other fields. The current wave of machine learning,
however, requires training data sets that are not only labeled but also sufficiently broad and
universal.

Deep-learning methods required thousands of observations for models to become relatively good
at classification tasks and, in some cases, millions for them to perform at the level of humans.
Without surprise, deep learning is famous in giant tech companies; they are using big data to
accumulate petabytes of data. It allows them to create an impressive and highly accurate deep
learning model.

Explain a problem

Large and complex models can be hard to explain, in human terms. For instance, why a particular
decision was obtained. It is one reason that acceptance of some AI tools are slow in application
areas where interpretability is useful or indeed required.

Furthermore, as the application of AI expands, regulatory requirements could also drive the need
for more explainable AI models.
Training, Testing and Evaluating Machine Learning Models

Model training
Model training for deep learning includes splitting the dataset, tuning hyperparameters and
performing batch normalization.

Splitting the dataset


The data collected for training needs to be split into three different sets: training, validation and
test.

•Training — Up to 75 percent of the total dataset is used for training. The model
learns on the training set; in other words, the set is used to assign the weights and
biases that go into the model.
• Validation — Between 15 and 20 percent of the data is used while the model is
being trained, for evaluating initial accuracy, seeing how the model learns and fine-
tuning hyperparameters. The model sees validation data but does not use it to learn
weights and biases.
• Test — Between five and 10 p
• ercent of the data is used for final evaluation. Having never seen this dataset, the
model is free of any of its bias.
Hyperparameter tuning
Hyperparameters can be imagined as settings for controlling the behavior of a training algorithm,
as shown below.
\Based on human-adjustable hyperparameters, the algorithm learns parameters from the data
during the training phase. They are set by the designer after theoretical deductions or adjusted
automatically.

In the context of deep learning, examples of hyperparameters are:

1. Learning rate
2. Number of hidden units
3. Convolution kernel width
4. Regularization techniques
There are two common approaches to tuning hyperparameters, as depicted in the diagram below.
The first, standard grid search optimization, is a brute-force approach through a predetermined
list of combinations of hyperparameters. All possible values of hyperparameters are listed and
looped through in an iterative fashion to obtain the best values. Grid search optimization takes
relatively little time to program and works well if the dimensionality in the feature-vector is low.
But as the number of dimensions increases, tuning takes longer and longer.

The other common approach, random search optimization, involves randomly sampling values
instead of exhaustively searching through every combination of hyperparameters. Generally, it
produces better results in less time than grid search optimization.

Batch normalization
Two techniques, normalization and standardization, both have the objective of transforming the
data by putting all the data points on the same scale in preparation for training.

The normalization process usually consists of scaling the numerical data down to a scale from
zero to one. Standardization, on the other hand, usually consists of subtracting the mean of the
dataset from each data point and then dividing the difference by the standard deviation of the
datasets. That forces the standardized data to take on a mean of zero and a standard deviation of
one. Standardization is often referred to as normalization; both boil down to putting data on some
known or standard scale.

Model evaluation and testing


Once a model has been trained, performance is gauged according to a confusion matrix and
precision/accuracy metrics.
Confusion matrix
A confusion matrix describes the performance of a classifier model, as in the 2x2 matrix depicted
below.

Consider a simple classifier that predicts whether a patient has cancer or not. There are four
possible results:

• True positives (TP) — Prediction was yes and the patient does have cancer.
• True negatives (TN) — Prediction was no and the patient does not have cancer.
• False positives (FP) — Prediction was yes, but the patient does not have cancer
(also known as a "Type I error").
• False negatives (FN) — Prediction was no, but the patient does have cancer (also
known as a "Type II error")
A confusion matrix can hold more than 2 classes per axis, as shown here:

Precision / Accuracy
It is also useful to calculate the precision and accuracy based on classifier prediction and actual
value.
Accuracy is a measure of how often, over all observations, the classifier is correct. The
calculation, based on the grid above, is (TP+TN)/total = (100+50)/(60+105) = 0.91.

Precision is a measure of how often the actual value is Yes when the prediction is Yes. In this
case, that calculation is TP/predicted yes = 100/(100+10) = 0.91.
Convolutional Neural Networks (CNN)

In the past few decades, Deep Learning has proved to be a very powerful tool because of its ability

to handle large amounts of data. The interest to use hidden layers has surpassed traditional

techniques, especially in pattern recognition. One of the most popular deep neural networks is

Convolutional Neural Networks.

Since the 1950s, the early days of AI, researchers have struggled to make a system that can

understand visual data. In the following years, this field came to be known as Computer Vision.

In 2012, computer vision took a quantum leap when a group of researchers from the University of

Toronto developed an AI model that surpassed the best image recognition algorithms and that too

by a large margin.

The AI system, which became known as AlexNet (named after its main creator, Alex Krizhevsky),

won the 2012 ImageNet computer vision contest with an amazing 85 percent accuracy. The runner-

up scored a modest 74 percent on the test.


At the heart of AlexNet was Convolutional Neural Networks a special type of neural network that

roughly imitates human vision. Over the years CNNs have become a very important part of many

Computer Vision applications and hence a part of any computer vision course online. So let’s take

a look at the workings of CNNs.

Background of CNNs

CNN’s were first developed and used around the 1980s. The most that a CNN could do at that time

was recognize handwritten digits. It was mostly used in the postal sectors to read zip codes, pin

codes, etc. The important thing to remember about any deep learning model is that it requires a

large amount of data to train and also requires a lot of computing resources. This was a major

drawback for CNNs at that period and hence CNNs were only limited to the postal sectors and it

failed to enter the world of machine learning.

In 2012 Alex Krizhevsky realized that it was time to bring back the branch of deep learning that

uses multi-layered neural networks. The availability of large sets of data, to be more specific
ImageNet datasets with millions of labeled images and an abundance of computing resources

enabled researchers to revive CNNs.

What exactly is a CNN?

In deep learning, a convolutional neural network (CNN/ConvNet) is a class of deep neural

networks, most commonly applied to analyze visual imagery. Now when we think of a neural

network we think about matrix multiplications but that is not the case with ConvNet. It uses a

special technique called Convolution. Now in mathematics convolution is a mathematical

operation on two functions that produces a third function that expresses how the shape of one is

modified by the other.

But we don’t really need to go behind the mathematics part to understand what a CNN is or how

it works.

Bottom line is that the role of the ConvNet is to reduce the images into a form that is easier to

process, without losing features that are critical for getting a good prediction.

How does it work?

Before we go to the working of CNN’s let’s cover the basics such as what is an image and how is

it represented. An RGB image is nothing but a matrix of pixel values having three planes whereas

a grayscale image is the same but it has a single plane. Take a look at this image to understand

more.
For simplicity, let’s stick with grayscale images as we try to understand how CNNs work.

The above image shows what a convolution is. We take a filter/kernel(3×3 matrix) and apply it to

the input image to get the convolved feature. This convolved feature is passed on to the next layer.
In the case of RGB color, channel take a look at this animation to understand its working
Convolutional neural networks are composed of multiple layers of artificial neurons. Artificial

neurons, a rough imitation of their biological counterparts, are mathematical functions that

calculate the weighted sum of multiple inputs and outputs an activation value. When you input an

image in a ConvNet, each layer generates several activation functions that are passed on to the

next layer.

The first layer usually extracts basic features such as horizontal or diagonal edges. This output is

passed on to the next layer which detects more complex features such as corners or combinational

edges. As we move deeper into the network it can identify even more complex features such as

objects, faces, etc.


Based on the activation map of the final convolution layer, the classification layer outputs a set of
confidence scores (values between 0 and 1) that specify how likely the image is to belong to a
“class.” For instance, if you have a ConvNet that detects cats, dogs, and horses, the output of the
final layer is the possibility that the input image contains any of those animals.

What’s a pooling layer?

Similar to the Convolutional Layer, the Pooling layer is responsible for reducing the spatial size

of the Convolved Feature. This is to decrease the computational power required to process the

data by reducing the dimensions. There are two types of pooling average pooling and max pooling.

I’ve only had experience with Max Pooling so far I haven’t faced any difficulties.
So what we do in Max Pooling is we find the maximum value of a pixel from a portion of the

image covered by the kernel. Max Pooling also performs as a Noise Suppressant. It discards the

noisy activations altogether and also performs de-noising along with dimensionality reduction.

On the other hand, Average Pooling returns the average of all the values from the portion of the

image covered by the Kernel. Average Pooling simply performs dimensionality reduction as a

noise suppressing mechanism. Hence, we can say that Max Pooling performs a lot better than

Average Pooling.

You might also like