Machine Learning NETWORK DeepLearning
Machine Learning NETWORK DeepLearning
MACHINE LEARNING
DEEP LEARNING Algorithms
Narration By
Dr. B. SWAMINATHAN
Dr. B. Swaminathan 2
Deep Learning Applications Used Across Industries
1. Virtual Assistants 2. Chat-bots 3. Healthcare
4. Entertainment 5. Composing Music 6. Image Coloring
7. Robotics 8. Image Captioning 9. Advertising
10. Self Driving Cars 11. Visual Recognition 12. Fraud Detection
13. Personalization's 14. Deep Dreaming 15. Pixel Restoration
16. Automatic Game Playing
17. Language Translations
18. Automatic Handwriting Generation
19. Demographic and Election Predictions
20. Natural Language Processing
21. News Aggregation and Fake News Detection
22. Adding Sounds to Silent Movies
23. Detecting Developmental Delay in Children
24. Colourization of Black and White images
25. Automatic Machine Translation
Dr. B. Swaminathan 3
Analytics(Predictions)
Descriptive Analysis: Which tells us what has already happened (The process of using
current and historical data to identify trends and relationships.)
• Traffic and Engagement Reports,
• Financial Statement Analysis : holistic view of a company’s financial health.; balance
sheet, income statement, cash flow statement,.
Vertical analysis, Horizontal analysis, ratio analysis,
• Demand Trends: NetFlix’s (use case)
• Aggregated Survey Results
• Progress to Goals(Key Performance Analysis)
Predictive Analysis: What could happen
• Finance: Forecasting Future Cash Flow
• Entertainment & Hospitality: Determining Staffing Needs
• Marketing: Behavioral Targeting
• Manufacturing: Preventing Malfunction
• Health Care: Early Detection of Allergic Reactions
Prescriptive Analysis: What should Happen in the Future “What should we do next?”
• .Venture Capital: Investment Decision
• Sales: Lead Scoring; Page views, Email interactions, Site searches, Content
engagement,
• Content Curation: Algorithmic Recommendations(TikTok’s )
• Banking: Fraud Detection
• Product Management: Development and Improvement
Dr. B. Swaminathan 4
Analytics(Predictions) Cont…
Diagnostic Analysis: Why did this happen?”
Cognitive Analysis:
SWOT: Strength Weakness ,Opportunities, and Threads
Dr. B. Swaminathan 5
6
7
What is Intelligence ?
•Intelligence:
•“the capacity to learn and solve problems” in particular,
- the ability to solve novel problems
- the ability to act rationally
- the ability to act like humans
8
9
10
11
12
AI Applications
• Autonomous Planning
& Scheduling:
– Autonomous rovers.
01/04/2021 13
AI Applications
• Autonomous Planning & Scheduling:
– Telescope scheduling
01/04/2021 14
AI Applications
• Autonomous Planning & Scheduling:
– Analysis of data:
01/04/2021 15
AI Applications
• Medicine:
– Image guided surgery
01/04/2021 16
AI Applications
• Medicine:
– Image analysis and enhancement
01/04/2021 17
AI Applications
• Transportation:
– Autonomous vehicle
control:
01/04/2021 18
AI Applications
• Transportation:
– Pedestrian detection:
01/04/2021 19
AI Applications
Games:
01/04/2021 20
AI Applications
• Games:
01/04/2021 21
AI Applications
• Robotic toys:
01/04/2021 22
23
24
Was
25
Was
is
26
27
is
28
Systems:
Other application areas:
Computer Games ● Bioinformatics:
Navigation Systems ○ Gene expression data analysis
○ Prediction of protein structure
Smart phone services ● Text classification, document sorting:
○ Web pages, e-mails
Intelligent email ○ Articles in the news
Search engines ● Video, image classification
● Music composition, picture drawing
Recommender systems ● Natural Language Processing
Self-driving cars ● Perception
29
Introduction to Artificial Intelligence
Ability of a machine to imitate
Artificial intelligent human behavior
Intelligence
System is ability to perform Automatically
Machine Learn and improve the performance
Learning
Machine uses algorithm and
uses the neural net to train the model
Deep Learning
Dr. B. Swaminathan
30
Machine Learning
Supervised Learning Algorithm
It’s Produce the o/p based on previous information(data)
Dataset have attributes (label) to train algorithms.
O/P is classify data or predict
Types
Regression
Classification
𝑆𝑥
𝒚=𝒂+𝒃𝒙 𝑏= 𝑟
𝑆𝑦
; 𝑎 = 𝑌ത − 𝑏 𝑋ത
ത
σ((𝑥 − 𝑋)(𝑦 ത
− 𝑌)) σ 𝑥 − 𝑋ത 2 σ 𝑦 − 𝑌ത 2
𝑟= ; 𝑆𝑥 = ; 𝑆𝑦 =
σ 𝑥 − 𝑋ത 2 σ 𝑦 − 𝑌ത 2 (𝑛 − 1) (𝑛 − 1)
Machine Learning:
Supervised Learning(Linear Regression)
HousePrice vs SquareFeet
3000
house price = 98.24833 + 0.10977 (square feet)
2500
HousePrice(Y)
2000
1500
1000
500
0
0.00 100.00 200.00 300.00 400.00 500.00
Series1 Linear (Series1) SquareFeet(X)
2500
2000
500
0
0.00 50.00 100.00 150.00 200.00 250.00 300.00 350.00 400.00 450.00
Linear Regression Example
Using Excel
ANOVA
df SS MS F Significance F
350
300 Slope
250
200
= 0.10977
150
100
50
Intercept 0
0 500 1000 1500 2000 2500 3000
= 98.248 Square Feet
1.
6. The values of r and r2 are computed
2
• standard deviation of errors is
• For a 90% confidence level, the area in each tail of the t distribution is
ETL Process: The typical Machine Learning ETL process is one of successive data
operations:-
Machine Learning
Labeled Data algorithm
Training
Prediction
Learned Predictio
Labeled Data model n
Dr. B. Swaminathan 57
Anatomy of a deep neural network
• Layers
• Input data and targets
• Loss function
• Optimizer
Dr. B. Swaminathan 58
Input data and targets
dog
Dr. B. Swaminathan 59
Deep learning Lasagn Keras TF torch.n Gluo
e Estimator n n
frameworks Thean TensorFlo CNTK PyTorc MXNe Caffe
o w h t
CUDA, cuDNN
HIP, MIOpen MKL, MKL-
• Keras is a high-level DNN
neural networks API
GPUs CPUs
• we will use TensorFlow
as the compute backend
• included in TensorFlow 2 as [Link]
• [Link] , [Link]
• PyTorch is:
• a GPU-based tensor library
• an efficient library for dynamic neural networks
• [Link]
Dr. B. Swaminathan 60
Natural Neural Network
Dendrites : These receive information or signals from other neurons that get
connected to it.
Cell Body : Information processing happens in a cell body. These take in all the
information coming from the different dendrites and process that information.
Axon : It sends the output signal to another neuron for the flow of
information. Here, each of the flanges connects to the dendrite or the hairs on
the next one. Dr. B. Swaminathan 61
Artificial Neural Network
Dendrites (designed to receive communications from other cells) from Biological Neural
Network represent inputs in Artificial Neural Networks, cell nucleus represents Nodes, synapse
represents Weights, and Axon represents Output.
Biological Neural Network Artificial Neural Network
Dendrites Inputs
Cell nucleus Nodes
Synapse Weights
Axon Dr. B. Swaminathan Output 63
Defining Neural Networks
Dr. B. Swaminathan 64
Neural Network Types
Dr. B. Swaminathan 65
Neural Network Representation
Feed forward Neural Network – Artificial Neuron
Radial basis function Neural Network
Self Organizing Neural Network
Recurrent Neural Network
Convolutional Neural Network
Modular Neural Network
Dr. B. Swaminathan 66
ML vs. Deep Learning
Dr. B. Swaminathan 67
ML vs. Deep Learning
• Deep learning (DL) is a machine learning subfield that uses multiple layers for
learning data representations
– DL is exceptionally effective at learning patterns
Dr. B. Swaminathan 68
ML vs. Deep Learning
• DL applies a multi-layer process for learning rich hierarchical features (i.e., data
representations)
– Input image pixels → Edges → Textures → Parts → Objects
Dr. B. Swaminathan 69
Elements of Neural Networks
z = a1w1 + a2 w2 + + aK wK + b
a1 w1
a2 w2
z (z )
+ a
…
wK output
…
aK weights
Activation
function
input
b
Dr. B. Swaminathan 70
bias
Elements of Neural Networks
• A NN with one hidden layer and one output layer
Weights Biases
Activation functions
4 + 2 = 6 neurons (not counting inputs)
[3 × 4] + [4 × 2] = 20 weights
4 + 2 = 6 biases
26 learnable parameters
Dr. B. Swaminathan 71
Types of Activation functions:
1. Step function,
2. Sign function,
3. Sigmoid function,.
Dr. B. Swaminathan 72
Neural Networks (Activation Function)
z1
3
0.95
y1 = z1 ( )
z2
1
0.73
y2 = z 2 ( )
z3
-3
0.05
y3 = z 3 ( )
e
20
z1 e e z1
y1 = e z1
zj
j =1
0.12 3
z2 1
e e z2 2.7 y2 = e z2 e
zj
j =1
0.05 ≈0 3
z3 -3
e
e
z3 zj
e y3 = e z 3
3 j =1
+ e
zj
j =1
• Sigmoid function σ: takes a real-valued number and “squashes” it into the range
between 0 and 1
▪ The output can be interpreted as the firing rate of a biological neuron
o Not firing = 0; Fully firing = 1
▪ When the neuron’s activation are 0 or 1, sigmoid neurons saturate
o Gradients at these regions are almost zero (almost no signal will flow)
▪ Sigmoid activations are less common in modern NNs
𝑓 𝑥
• Tanh function: takes a real-valued number and “squashes” it into range between -
1 and 1
▪ Like sigmoid, tanh neurons saturate
▪ Unlike sigmoid, the output is zero-centered
o It is therefore preferred than sigmoid
▪ Tanh is a scaled sigmoid: tanh(𝑥) = 2 ∙ 𝜎(2𝑥) − 1
𝑓 𝑥 ℝ𝑛 → −1,1
Activation: ReLU
• Linear function means that the output signal is proportional to the input signal to
the neuron
……
……
……
……
……
xN …… yM
Dr. B. Swaminathan 84
Five recognized types of neural networks.
Single-layer feed-forward network.
Multilayer feed-forward network.
Model structure is same but has a greater number of hidden layers.
Multi-layer model is also known as the Back propagation algorithm,
It executes in two stages
1. Feed Forward propagation
• A feed forward neural network nodes never form a cycle.
• Neural Network has an input layer, hidden layers, and an output
layer.
2. Backward propagation
• Task is to classify data set.
• Computes the gradient of the loss function for a single weight by
the chain rule.
Single node with its own feedback.
Single-layer recurrent network.
Multilayer recurrent network.
Dr. B. Swaminathan 85
Single-layer feed-forward network.
Input Output
Only Input and output layers.
X1
w11
O1 No computation is performed in Input layer.
Different weights are applied to input nodes &
w12
Cumulative effect per node is taken. ,
X2
w21
O2 Neurons collectively give the output layer to
W31
compute the output signals.
X3 O3 In Output layer only calculations are ther
Wn1
Xn On
Wnn
Dr. B. Swaminathan 86
Sample Calculation
Given:
x1 = 2, x2 =3;
w1 = 0, w2 = 1;
bias = 0;
Activation = Sigmoid;
Activation Function
h1 = x1 * w1 + x2 * w2 ⇒ 2*0 + 3 * 1 = 3 = 3
h2 = x1 * w1 + x2 * w2 ⇒ 2*0 + 3 * 1 = 3 = 3
X = (h1 * w1 + h2 * w2) + b ⇒ 3*0 + 3*1 + 0 = 30
Dr. B. Swaminathan 87
Sample Calculation 2
1 ∙ 1 + −1 ∙ −2 + 1 = 4
4 0.98 Sigmoid Function
1
1
-2 1
(z ) =
1 1 + e−z
(z )
-1 -2 0.12
-1
1 z
0
• A simple network, toy example (cont’d)
▪ For an input vector [1 −1]𝑇 , the output is [0.62 0.83]𝑇
𝑓: 𝑅2 → 𝑅2 1 0.62
𝑓 =
−1 0.83
Example
Single-layer recurrent network:
Dr. B. Swaminathan 90
3) Waveform is split based on every letter. Now we will split the sound wave for the letter
W into smaller segments.
Amplitude varies in the sound wave, Analyze the letter 'W'
Dr. B. Swaminathan 91
5. Weights get multiplied with the inputs, and a bias is added to form the transfer function
Transfer Function transfer the input to output signal(Weighted Sum with bias)
Dr. B. Swaminathan 93
2. Long Short Term Memory Networks (LSTMs)
A type of Recurrent Neural Network (RNN)
That can learn and memorize long-term dependencies.
How LSTMs Work?
First, they forget irrelevant parts of the previous state
Next, they selectively update the cell-state values
Finally, the output of certain parts of the cell state
Dr. B. Swaminathan 94
LSTM building block
Dr. B. Swaminathan 95
Memory Pipe
Forget Gate
New Memory Valve Two signs are the forget valve and the
new memory valve
Dr. B. Swaminathan 96
Generate the output for this LSTM unit forget gate (valve) that shuts the old memory:
Dr. B. Swaminathan 97
Dr. B. Swaminathan 98
Dr. B. Swaminathan 99
Dr. B. Swaminathan 100
3. Recurrent Neural Networks (RNNs)
The output from the LSTM becomes an input to the current phase and can
memorize previous inputs due to its internal memory. RNNs are commonly used
for image captioning, time-series analysis, natural-language
processing, handwriting recognition, and machine translation.
TensorFlow: machine learning and deep learning models are easily developed and evaluated
Seaborn: ML projects because it can generate plots of learning data.
Theano: numerical computation and specifically for machine learning.
Optimize and evaluate mathematical models and matrix calculations.
used by machine learning and deep learning developers
Keras: developing the neural networks for ML models.
PyTorch: natural language processing or computer vision. For Large dense Data.
Matplotlib: Data Visulization tools