Presentation of AI ML Session 1
Presentation of AI ML Session 1
Presentation of AI ML Session 1
and
Deep Learning
By:
Dr. Amit Ganatra
What is Learning?
• “Learning denotes changes in a system that ... enable a system to do
the same task … more efficiently the next time.” - Herbert Simon
• “Learning is constructing or modifying representations of what is
being experienced.” - Ryszard Michalski
• “Learning is making useful changes in our minds.” - Marvin Minsky
HUMAN RATIONAL
Artificial
• Produced by human art or effort, rather than originating naturally.
• “Intelligence is the ability to acquire knowledge and use it" -
Pigford and Baur
• Increased costs
• Difficulty with software development - slow and expensive
• Few experienced programmers
• Few practical products have reached the market as yet.
Areas of AI
Knowledge
Search Logic Representation
Machine
Planning
Learning
Expert
NLP Vision Robotics Systems
Machine Learning
Machine Learning – A definition
Semi-supervised learning
Image Source:
https://utkuufuk.github.io/2018/06/03/one-vs-all-
classification/
https://www.edvancer.in/foundations-of-data-science-
made-simple-part-2/
Linear and Non Linear Classification
• Linear Classification • Non-Linear Classification
Find a straight line to separate (classify) There is no way that a straight line can be drawn to
green from blue discriminate the two classes
• Clustering
• K-means clustering
• Spectral clustering
• Density Estimation
• Gaussian mixture model (GMM)
• Graphical models
• Dimensionality reduction
• Principal component analysis (PCA)
• Factor analysis
Applications of unsupervised learning:
• Clustering: Grouping similar instances
• Other applications: Summarization, Association Analysis
• Example applications:
• Customer segmentation in CRM
• Image compression: Color quantization
• Bioinformatics: Learning motifs
Reinforcement Learning
• A computer program interacts with a dynamic environment in which it must
perform a certain goal. The program is provided feedback in terms of rewards
and punishments as it navigates its problem space.
• Policies: what actions should an agent take in a particular situation
• Utility estimation: how good is a state (used by policy)
• No supervised output but delayed reward
• Credit assignment problem (what was responsible for the
outcome)
• Applications:
• Game playing
• Robot in a maze
• Multiple agents, partial observability, ...
Image Source: https://towardsdatascience.com/types-of-machine-learning-algorithms-you-should-know-953a08248861
Examples of real-life problems in the context of supervised and unsupervised learning tasks: Spam filtering
as a classification task and House price estimation as a regression task are part of supervised learning;
Clustering is part of unsupervised learning in which customers are grouped into three different categories
based on their purchasing behavior.
Image Source: DEEP GENERATIVE MODELS FOR SYNTHETIC RETINAL IMAGE GENERATION, Lappeenranta University of Technology, July 2017
Image Source: https://www.datarobot.com/wiki/machine-learning-life-cycle/
Machine Learning Applications
• Recognizing Patterns:
• Facial identities or facial expressions
• Handwritten or spoken words
• Medical images
• Generating Patterns:
• Generating images or motion sequences
• Recognizing Anomalies:
• Unusual sequences of credit card transactions
• Unusual patterns of sensor readings in a nuclear power plant or unusual sound
in your car engine.
• Prediction:
• Future stock prices or currency exchange rates
Some web-based examples of machine learning
• The web contains a lot of data. Tasks with very big datasets often use machine
learning
• especially if the data is noisy or non-stationary.
• Spam filtering, fraud detection:
• The enemy adapts so we must adapt too.
• Recommendation systems:
• Lots of noisy data. Million dollar prize!
• Information retrieval:
• Find documents or images with similar content.
• Data Visualization:
• Display a huge database in a revealing way.
Python Libraries for Machine Learning
Mathematics for Data Manipulation
Machine Learning Visualization
Data Science & Analysis
Scikit-Learn - (formerly scikits.learn)
It features various classification, regression and clustering algorithms
including support vector machines, random forests, gradient
boosting, k-means and DBSCAN, and is designed to interoperate with
the Python numerical and scientific libraries NumPy and SciPy.
Scikit-Learn
TensorFlow
TensorFlow™ is an open source software library for high
performance numerical computation. Its flexible architecture allows
easy deployment of computation across a variety of platforms
(CPUs, GPUs, TPUs), and from desktops to clusters of servers to
mobile and edge devices. Originally developed by researchers and
engineers from the Google Brain team within Google’s AI
organization, it comes with strong support for machine learning and
deep learning and the flexible numerical computation core is used
across many other scientific domains.
Keras
• Keras is a high-level neural networks API, written in Python and
capable of running on top of TensorFlow, CNTK, or Theano. It was
developed with a focus on enabling fast experimentation.
• Allows for easy and fast prototyping (through user friendliness,
modularity, and extensibility).
• Supports both convolutional networks and recurrent networks, as
well as combinations of the two.
• Runs seamlessly on CPU and GPU.
OpenCV
• OpenCV is the leading open source library for computer vision,
image processing and machine learning, and now features GPU
acceleration for real-time operation.
• OpenCV is released under a BSD license and hence it’s free for both
academic and commercial use. It has C++, C, Python and Java
interfaces and supports Windows, Linux, Mac OS, iOS and Android.
OpenCV was designed for computational efficiency and with a
strong focus on real-time applications. Written in optimized
C/C++, the library can take advantage of multi-core processing.
Research issues in Machine Learning
• Handling large amount of data
• High dimensionality
• Training Time is more (Hours or Days)
• Labeling of data or labeling of Images & Videos
• Processing Performance for Training and Testing (Validating)
• Accessing Reference Model – Transfer Learning
• Optimizing Hyper parameters
• Rapid and Optimized deployment
• Curse of Modularity
• Class Imbalance
• Feature Engineering
• Variance and Bias
• Feature Extraction
• Applications specific training – Less Generalization
Growth of Machine Learning – Current State
1965 1986
Alexey Ivakhnenko Geoffrey Hinton
First works on
backpropagation
Deep neural networks
algorithm
A bit of History
2011 2012
Microsoft Geoffrey Hinton
(University of Toronto)
breakthrough
in speech recognition breakthrough
in computer vision
Researchers of Deep Learning
Let’s take an example. Suppose we use deep learning to give automated scoring to essays. The
performance it gives in scoring is quite excellent and is near human performance. But there’s is an issue.
It does not reveal why it has given that score. Indeed mathematically you can find out which nodes of a
deep neural network were activated, but we don’t know what these neurons were supposed to model
and what these layers of neurons were doing collectively. So we fail to interpret the results.
On the other hand, machine learning algorithms like decision trees give us crisp rules as to why it chose
what it chose, so it is particularly easy to interpret the reasoning behind it. Therefore, algorithms like
decision trees and linear/logistic regression are primarily used in industry for interpretability.
Where is Machine Learning and Deep Learning being
applied right now?
• Computer Vision: for applications like vehicle number plate identification
and facial recognition.
• Information Retrieval: for applications like search engines, both text search,
and image search.
• Marketing: for applications like automated email marketing, target
identification
• Medical Diagnosis: for applications like cancer identification, anomaly
detection
• Natural Language Processing: for applications like sentiment analysis,
photo tagging
• Online Advertising
Why Deep Learning taking off?
3. Efficient Algorithms
Types of Deep Networks
• There are different deep networks like
• Convolutional Neural Network (CNN),
• Recurrent Neural Network (RNN),
• Deep Belief Network (DBN),
• Recursive Neural Tensor Network (RNTN),
• Long and Short Term Memory (LSTM)
• Restricted Boltzman Machine (RBM).
• Auto Encoder
• GAN
Types of Deep Network
Applications Deep Network
CNN is a type of artificial neural network - are variations of RNN unlike neural networks - can use their
multilayer perceptron which are designed to use minimal internal memory to process arbitrary sequences
amounts of preprocessing. of inputs.
It is used when there is analysis of image data set , for example, RNNs are ideal for text and speech analysis. It is
classify or detect objects. CNNs are ideal for images and video used in sentiment analysis for text containing
processing. product reviews.
Comparison of Deep Learning Models
Auto-
Model CNN RNN LSTM RBM DBN
encoder
Type Discriminative Discriminative Discriminative Generative Generative Generative
Unsupervised Unsupervised
Dimensionality
Purpose Classification Prediction Prediction Feature Feature
Reduction
Learning Learning
Creating a Creating a
Learning
Processing two- Processing Processing long probabilistic compact
Suitable for distribution of
dimensional data sequence data sequence data recommendati representation
data
on of data of data
CIFAR 1,0 2,677 1,790 2,097 1,741 1,0 572 272 1,02 313
61 61 7
ImageNet 3,0 6,875 5,912 9,682 5,034 30,954 3,0 1,475 945 2,43 903 1.35* 105
25 25 2
Findings
• As long as the data is small enough to fit on one machine, one
machine with GPU capability outperforms other architectures .
• Network communication varies directly with model size.
• The local implementations have no data-parallelism and no
network-overhead.
• GPUs speeding up mathematical operations.
• GPU has its own memory, so GPU memory can become a
bottleneck if matrices are too large to fit the somewhat limited
typical GPU memory.
Comparison of Framework
Framework Core Bindings Single Multi Open Distributed Comments
Language GPU GPU Source
Caffe C++ Python, See Mostly for Image Classification, Models/
Matlab com.yahoo.ml.C layers expressed in proto format
affeOnSpark
1: CAT
0: NOT CAT
model(X_train, Y_train, X_test, Y_test, num_iterations = 2000, learning_rate = 0.5, print_cost = False)
Algorithm:
• Define the model structure (such as number of inputs and
outputs)
• Initialize the model's parameters.
• Loop.
• Calculate current loss (forward propagation)
• Calculate current gradient (backward propagation)
• Update parameters (gradient descent)
• Repeat Until it Converges
y = mx + c
y - y1 = m(x - x1)
y - 4 = (-1.6)(x - (-2))
y - 4 = -1.6x - 3.2
y = -1.6x - 3.2 + 4
y = -1.6x + 0.8
y = -1.6(3) + 0.8
y= -4
Activation Function
1. Forward Propagation Equation
Loss
Cost
2. Backward Propagation
Gradient Descent
3. Update parameters (gradient descent)
𝝏𝑱
𝒃=𝒃 −𝜶
𝝏𝒃
model(X_train, Y_train, X_test, Y_test, num_iterations = 2000, learning_rate = 0.5, print_cost = False)
Input
2 layer NN (1 HL + 1 OL)
Parameters and Hyperparameters
Parameter - Weight and Bias
Hyperparameter (parameters that control the algorithm):
1) No of hidden layers - Trial and error
2) No of neurons in each hidden layer - Trial and error
3) Learning rate. (The most important parameter) – 0.1, 0.01, 0.001, 0.0001, .00001
4) Activation functions – Sigmoid, Relu, Leaky Relu, Tanh
5) Number of iteration – Trial and error
6) Epoch – Trial and error
7) Batch size – 4, 8, 16, 32, 64, 128… (Power of 2)
8) Regularization – Dropout, L1, L2
9) Regularization Rate and Dropout lambda
10)Normalizing inputs – Min-max, mean, Z-Score
11)Weights and Bias Initialization – Zero, Random
12)optimization algorithm
13)Learning rate decay
14)Momentum – 0.9
Iterations, Epoch and Batch Size
• batch size = the number of training examples in one
forward/backward pass. The higher the batch size, the more
memory space you'll need.
• number of iterations = number of passes, each pass using [batch
size] number of examples. To clear, one pass = one forward pass +
one backward pass (we do not count the forward pass and
backward pass as two different passes).
• one epoch = one forward pass and one backward pass of all the
training examples.
• Example: if you have 5000 training examples, and your batch size
is 32, then it will take 157 iterations to complete 1 epoch.
• 5000/32 = 156.25 =157 iterations
Empirical Process
Application of CNN
2. RNN (recurrent neural network)
Application of RNN
1. Automatically Adding Sounds To Silent Movies
2. Automatic Text Generation
3. RBM (Restricted Boltzmann Machine)
Applications of RBM:
Feature extraction
Labelling of dataset
Construct Deep Belief Networks
4. Deep Belief Network
1. Unsupervised pre-learning provides a
good initialization of the network
2. Supervised fine-tuning
Application:
• Image/ Face Recognition
• Video Sequence recognition
• Motion-capture data
Ronan
Linux, Mac OS,
Collobert,Ka BSD Lua, C, utility library for
Torch Yes Windows, C, Lua Yes
vukcuoglu, License C++/OpenCL
Android, iOS
Clement
Python, C++,
Microsoft
Microsoft Command line,
Cognitive MIT license Yes Windows, Linux C++ Yes
Research BrainScript(.NET on
Toolkit - CNTK
roadmap)
Schematic Diagram
Input image/
video Applications output Class/object
and (Python scripts) score
weight file
(Trained model)
Evaluation Parameters
• Accuracy – Confusion matrix
• Precision
• Recall
• F1 Score (try to maximize - to create a balanced classification
model)
• mAP – IOU (For Object Detection)
• Loss/Cost – Minimize the difference between actual and predicated
• Entropy
Dear, Do you remember all wedding
anniversary surprises from me?
• https://playground.tensorflow.org
• http://scs.ryerson.ca/~aharley/vis/conv/
NVIDIA Titan Xp
(Grant by Nvidia Graphics Pvt. Ltd.)
Configuration
• GPU Architecture – Pascal
• VR Ready
Work Station
Configuration
• 32 GB RAM
• 2 TB HDD
Model Loss vs. Epoch in CPU Model Accuracy vs. Epoch in CPU
Results in GPU of CNN Model
Model Loss vs. Epoch in GPU Model Accuracy vs. Epoch in GPU
Comparison of training time CNN model in CPU
and GPU
Training Time vs Processing Unit
900
800
700
600
Time (Seconds)
500
400
300
200
100
0
CPU GPU
Training Time 845 80
ML/DL Conferences/Journals
• CVPR - Conference on Computer Vision and Pattern Recognition
• NIPS - Neural Information processing systems
• ICML - International conference on machine learning
• ECCV - European Conference on Computer Vision
• ICCV - International Conference on Computer Vision
• ECML - European Conference on Machine Learning
• IJCAI - International Joint Conference on Artificial Intelligence
• JML - Journal of Machine Learning
• IEEE Transactions on Neural Networks
• IEEE Transactions on Pattern Analysis and Machine Intelligence
• Neural Networks
• Artificial Intelligence
• Pattern Recognition
• Expert Systems with Applications
• IEEE Transactions on Knowledge and Data Engineering
• Neural Computing and Applications
• IEEE Transactions on Audio, Speech and Language Processing
• International Journal of Neural Systems
Challenges with Deep Learning
Any Question..?