Lesson 2 - Fundamentals of Machine Learning and Deep Learning
Lesson 2 - Fundamentals of Machine Learning and Deep Learning
AI
Machine learning (ML) is an
It involves teaching a computer to recognize
application of artificial intelligence. ML
patterns in the data and creating rules rather
than programming it in traditional methods.
Google uses artificial intelligence and machine learning in almost all of its applications.
Google Utilizing AI
Google Photos uses machine learning in smart search to display photos related to the keywords you
searched for and animate similar photos from your albums into quick videos.
The Smart Compose and Smart Reply features of Gmail uses AI to suggest phrases and
complete sentences when you draft an email or a reply. The spam filter uses artificial neural
networks to analyze and flag spam messages.
Google Assistant has recently launched a new feature called Google Duplex that lets AI take
over some real-world task such as booking a haircut appointment over phone.
The feature Talk to Books lets you make a statement or ask a question and surfaces relevant
passages from the books using machine learning.
Relationship Between AI, ML, and DL
The goals of machine learning and statistical analysis are same, but
the formulations are significantly different.
Formulations of ML and Statistical Analysis
It takes away the deterministic function f out It tries to estimate the function f:
of the equation: Dependent Variable (Y) = f (Independent Variable)
Output(Y) ----- > Input (X) + Error Function
Naming Conventions of ML and Statistical Analysis
ML leverages on existing data, images, and videos to train algorithms and models.
Numerous set of examples are fed into the system and are called training sets.
The larger the training set, the more accurate the AI system would be.
Test data
Predictions
Learned model
Input data Output
Machine Learning Process
Training Phase
Labeled data is given as input The algorithm studies the A machine learning model is
into the algorithm along with the patterns in the data and works derived, which can then be
expected output or labels. This is out a logic based on the used with test dataset.
called the training data. training data input and output.
Machine Learning Process
Testing Phase
Test data
Predictions
Learned model
Input data Output
The test data contains only the The system classifies the test data The patterns from the test
inputs, and the output is based on the patterns learned data and the logic of the
generated by the system based from the training data. learned model are used to
on the logic derived from the make predictions and derive
training data. output.
Fundamentals of Machine Learning and Deep Learning
Topic 4: Types of Machine Learning
Types of Machine Learning
• In case of supervised learning, the ML program is provided with training data along
with the expected output or rules to categorize this data also known as labels.
• The ML system uses this set of inputs and outputs to predict the output for future
unseen inputs. It works well in the classification.
Supervised Learning Process
+
Input data Expected Learned model
algorithm
features output
Supervised Learning Example
These are
Apples
Supervised Learning Example
Number of
Bathrooms Garage space Year it was built Location
rooms
Meaning of Unsupervised Learning
Training data
Machine learning
Input data Learned model
algorithm
features
Unsupervised Learning Example: Image Identification
Visible
Pattern
Step two: Train the model
• The model identifies the patterns like shape, color,
and size in the data.
• It groups the fruits based on these features,
Model
attributes, or qualities.
Known
data
Unsupervised Learning Example: Litterati
Labeled data
Training data
Unlabeled data
Semi-supervised Learning Example
Model model.
Training data
Meaning of Reinforcement Learning
Unsupervised Learning
Semi-supervised Learning
Reinforcement Learning
Quiz Time
Unsupervised Learning
Semi-supervised Learning
Reinforcement Learning
Fundamentals of Machine Learning and Deep Learning
Topic 5: Algorithms of Machine Learning
Machine Learning Algorithms
The two main types of supervised learning that use labeled data are
regression and classification.
Classification
By fitting to the labeled training set, you can find the most optimal model
parameters to predict unknown labels on other objects (test set).
If the label is a real number, we call the task regression. If the label is from the limited number of unordered
For example, finding actual value of house price based values, we call it classification. For example,
features like location, construction year, etc. classifying images of animals into separate groups
(labels) of dogs and cats.
Linear Regression
Google Translate
Google Translate
Yes
than 1 hour
No
• The end of the branch that doesn’t split anymore is the
decision/leaf.
Commute more
than 1 hour
Decline offer • In this case, the condition whether the employee accepts or
Yes rejects the job offer is represented as green oval shaped
No
boxes.
Offers free
coffee
Decline offer
• This tree is called as classification tree as the target is to
classify whether the job is accepted by the employee or not.
Yes
No
• Naive Bayes is a simple but surprisingly powerful algorithm for predictive modeling.
• The model comprises of two types of probabilities: the probability of each class and
the conditional probability of each class based on the value of x.
• Once calculated, this probability model can be used to make predictions for new data
using Bayes theorem.
• The probabilities can be easily estimated as bell curve when your data is real valued.
Naive Bayes Example
How does an email client classify between valid and spam emails?
Spam/Junk Ham/Inbox
Naive Bayes Classification
• The objects can be classified as either green or red. The task is to classify new cases
as they arrive.
• For Example, using Naïve Bayes, you can classify the class labels based on the
current objects.
• Since there are twice as many green objects as red, it is reasonable to believe that a
new case (which has not been observed yet) has same ratio.
Naive Bayes Classification
Since there is a total of 60 objects, 40 of which are green and 20 are red, prior probabilities
for class membership are:
• Prior probability for green: 40/60
• Prior probability for red: 20/60 (number of red objects/total number of objects)
Naive Bayes Classification
• The more green (or red) objects there are in the vicinity of X, the more likely that the new
cases will belong to that particular color.
• To measure the likelihood, draw a circle around X which encompasses a number of points
irrespective of their class labels.
• Then, calculate the number of points in the circle that belong to each class label.
Naive Bayes Classification
CALCULATION OF LIKELIHOOD
In this illustration, it is clear that likelihood of X given GREEN is smaller than Likelihood of
X given RED, since the circle encompasses 1 GREEN object and 3 RED ones.
Naive Bayes Classification
CALCULATION OF PRIOR PROBABILITY
• Although the prior probabilities indicate that X may belong to GREEN (given that there
are twice as many GREEN compared to RED) the likelihood indicates otherwise.
• The class membership of X is RED (given that there are more RED objects in the vicinity
of X than GREEN).
• In Bayesian analysis, the final classification is produced by combining both sources of
information, i.e., the prior and the likelihood, to form a posterior probability using
Bayes' rule (named after Rev. Thomas Bayes 1702-1761).
Naive Bayes Classification
CALCULATION OF PRIOR PROBABILITY
Naive Bayes Classification
Finally, we classify X as RED since its class membership achieves the largest posterior probability.
Machine Learning Algorithms
• K-Means clustering is an algorithm that can be used for any type of grouping.
• Examples of K-Means clustering:
o Group images
o Detect activity types in motion sensors
o Separate bots from anomalies
o Segment by purchasing history
• Meaningful changes in data can be detected by monitoring to see if a tracked data point
switches groups over time.
K-Means Clustering: Use Cases
Segment by purchase Group inventory by Detect activity types in Separate valid activity
history sales activity motion sensors groups from bots
Define personas
Separate audio
based on interests
• To run a K-Means algorithm, randomly initialize three points called the cluster centroids.
• There are three cluster centroids in the image given below since data is grouped into three
clusters.
Step 1:
Step 2:
Algorithm calculates average of all points in cluster and moves centroid to the average location.
K-Means Clustering for Unsupervised Learning
• Steps 1 and 2 are repeated until there are no changes in clusters or when the specified
condition is met.
ML
Deep learning (DL) is a subset of
The term deep learning refers to deep
machine learning. DL
artificial neural networks, and less frequently
to deep reinforcement learning.
• Babies, from the time they are born until they grow up to be
toddlers, learn to recognize and distinguish multiple objects like
trees, dogs, cats, bottles etc.
• The more data you feed or teach them, the better their recognition
capabilities become.
• Imagine the number of “training” examples of each they must have
seen to be able to distinguish these things.
• The same goes for machine learning and deep learning applications
like facial recognition, image/object recognition, etc. The more data
we feed the model, the better it becomes.
Artificial Neural Networks
A perceptron is a neural network unit (an artificial neuron) that does certain
computations to detect features or business intelligence in the input data.
Meaning of Multilayer Perceptron
• The field of artificial neural networks is often called neural networks or multilayer perceptron.
• It investigates how simple models of biological brains can be used to solve difficult computational
tasks like the predictive modeling in machine learning.
• The goal is to develop robust algorithms and data structures that can be used to model difficult
problems.
Structure of Multilayer Perceptron
Outputs
Activation • A row of neurons is called a layer, and one network can have
weights multiple layers.
• The architecture of the neurons in the network is often called
Inputs the network topology.
Model of a simple neuron • Layers after the input layer are called hidden layers because
they are not directly exposed to the input.
Output layer • The simplest network structure is to have a single neuron in the
hidden layer that directly outputs the value.
Hidden • The final hidden layer is called the output layer.
layer
Input layer
Online The weights in the network are updated from the errors calculated for each
learning training example. This is called online learning.
Batch The errors can be saved up across all of the training examples, and the
learning
network can be updated at the end. This is called batch learning.
• Once a neural network has been trained, it can be used to make predictions.
Deep Neural Networks
• Artificial Neural Networks (ANN) are multi- • Deep Neural Networks (DNN) are layers that
layer fully-connected neural nets. have more than one hidden layer between input
and output layers.
Convolutional Neural Networks (CNN)
Until quite recently, computers were not good at tasks like recognizing a
puppy in a picture or recognizing spoken words, which humans excel at.
Uses of CNN
Automatic video
classification systems
Voice recognition
Self-
driving
cars
Natural
Image language
search processing
CNN Applications
Quiz Time
Source: https://www.Time.com/
Future Forecasted Revenue of AI
Source: https://www.statista.com/
Quiz
QUIZ
What are the different ways in which a machine can learn?
1
a. Deep learning is a subset of machine learning in Artificial Intelligence (AI) with networks
capable of learning unsupervised from data that is unstructured or unlabeled.
b. Machine learning is a subset of deep learning in Artificial Intelligence (AI) that has human
brain networks capable of learning unsupervised from data that is unstructured or unlabeled.
c. Deep learning is a set of algorithms that are arranged one after another in tandem (like
regression, KNN, Naive Bayes, decision trees), to enable maximum accuracy.
a. Deep learning is a subset of machine learning in Artificial Intelligence (AI) with networks
capable of learning unsupervised from data that is unstructured or unlabeled.
b. Machine learning is a subset of deep learning in Artificial Intelligence (AI) that has human
brain networks capable of learning unsupervised from data that is unstructured or unlabeled.
c. Deep learning is a set of algorithms that are arranged one after another in tandem (like
Regression, KNN, Naive Bayes, decision trees), to enable maximum accuracy.
Deep learning is a subset of machine learning in Artificial Intelligence (AI) that has networks capable
of learning unsupervised from data that is unstructured or unlabeled. Also known
as Deep Neural Learning or Deep Neural Network.
Key Takeaways
Neural networks are set of algorithms that are modeled loosely after the
human brain and are designed to recognize patterns.
This concludes “Fundamentals of Machine Learning
and Deep Learning.”
The next lesson is “Machine Learning Workflow.”