You are on page 1of 150

Image and Video Processing Using Machine Learning

• To introduce students
to the basic concepts
and techniques of
Machine Learning and
become familiar with
Objective regression methods,
classification
methods, clustering
methods.

Dr K.Veera Swamy, Professorm ECE, VCE


Image and Video Processing Using Machine Learning
COURSE OUTCOMES
On completion of the course, students will be able to

• Describe the basic concepts of Machine Learning


1

• Apply machine learning techniques suitable for a given problem


2

• Develop Machine Learning models in the paradigms of supervised


3 and un-supervised learning

• Analyze the performance of various models using appropriate


4 metrics

• Design and implement various machine learning algorithms in a


5 range of real-world applications
Dr K.Veera Swamy, Professorm ECE, VCE
Image and Video Processing Using Machine Learning

• Introduction to Machine
learning, Core concepts,
Data inconsistencies,
Practical Machine learning
applications, Types of

Unit I learning
Machine
architecture,
problems,
learning
Machine
learning algorithms.
• Linear Regression, Cost
Function, Gradient descent
and Logistic Regression.

Dr K.Veera Swamy, Professorm ECE, VCE


Image and Video Processing Using Machine Learning

• Working with Decision


tress: Basics of Decision
trees, uses, Advantages,
Limitations, different
algorithm types - ID3, C4.5,

Unit II CART
• Bayesian Networks: Graph
theory, probability theory,
Bayes theorem, working of
Bayesian Networks, Node
counts, using Domain
Experts.

Dr K.Veera Swamy, Professorm ECE, VCE


Image and Video Processing Using Machine Learning

• Support vector Machines:


Definition of SVM, uses of
SVM, Basic classification
principles, How Support
Vector Machines
Unit III Approach classification
• Clustering: Definition of
clustering, clustering
types-K-means,
Agglomerative
hierarchical, DBSCAN.

Dr K.Veera Swamy, Professorm ECE, VCE


Image and Video Processing Using Machine Learning

• Deep learning:
Background, Deep
learning Taxonomy,
Convolutional
Unit IV Neural networks,
Recurrent Neural
Networks,
Autoencoders.

Dr K.Veera Swamy, Professorm ECE, VCE


Image and Video Processing Using Machine Learning

• Applications of Machine
learning:
• Image retrieval
• Face recognition
• Video classification.
Unit V • Image Segmentation
using K-means clustering
• Satellite Image
Classification using
Decision Trees.

Dr K.Veera Swamy, Professorm ECE, VCE


Image-Video
Image: Discrete-space and discrete-amplitude

Video: Discrete-space, discrete-amplitude and discrete-time.

Dr K.Veera Swamy, Professorm ECE, VCE


Digital Video
Ordered sequence of digital image frames played in succession at a given
rate:

Discrete-space, discrete-amplitude and discrete-time.


Dr K.Veera Swamy, Professorm ECE, VCE
Digital Video

Dr K.Veera Swamy, Professorm ECE, VCE


Image /Video Processing

Dr K.Veera Swamy, Professorm ECE, VCE


Machine Learning

Training

Testing

Dr K.Veera Swamy, Professorm ECE, VCE


Machine Learning-Introduction
One limiting feature of
programmed tools is their
rigidity. Once the program
has been written down and
installed, it stays unchanged.
However, many tasks change A branch of artificial
over time or from one user to intelligence, concerned
another. Machine learning with the design and
tools whose behavior adapts development of
to their input data give algorithms that allow
solution to such issues. computers to evolve
behaviors based on
empirical data.
Dr K.Veera Swamy, Professorm ECE, VCE
Program Vs ML
• Example 1: Add numbers 5+8
– func f(5,8)
– Returns(5+8)
• Example 2: Add numbers
– func rec.digit(digit_image)

Computer: First one is easy, second one is tough


Human :Both are easy

Dr K.Veera Swamy, Professorm ECE, VCE


Machine Learning-Introduction
Traditional Programming

Data
Program Output
Rules

Machine Learning

Data
ML Rules/Patterns/
Intended Model
Output

Dr K.Veera Swamy, Professorm ECE, VCE


ML in a Nutshell
• Tens of thousands of machine learning
algorithms
• Hundreds new every year
• Every machine learning algorithm has three
components:
– Representation
– Evaluation
– Optimization
Representation
• Logical: Decision trees
• Geometric: Support vector machines
• Probabilistic: Graphical models
(Bayes/Markov nets)
• Neural networks
• Etc.
Evaluation
• Accuracy, Precision and recall
• Squared error
• Cost / Utility
• Etc.
Optimization
Optimization is the process where we train the model
iteratively that results in a maximum and minimum function
evaluation. It is one of the most important phenomena in
Machine Learning to get better results.
• Combinatorial optimization
– E.g.: Greedy search
• Convex optimization
– E.g.: Gradient descent
• Constrained optimization
– E.g.: Linear programming
Gradient Descent is an optimization A Greedy algorithm is an approach to
algorithm, and it finds out the local minima solving a problem that selects the
of a differentiable function. It is a most appropriate option based on the
minimization algorithm that minimizes a current situation.
given function. Linear Optimization may be defined as the problem of
maximizing or minimizing a linear function that is subjected to
linear constraints.
Optimization
• In general, solvers return a local minimum (or
optimum). The result might be a global minimum
(or optimum), but this result is not guaranteed.
• A local minimum of a function is a point where
the function value is smaller than at nearby
points, but possibly greater than at a distant
point.
• A global minimum is a point where the
function value is smaller than at all other feasible
points.

One-dimensional basins
One basin of attraction, showing steepest descent paths
from various starting points
Dr K.Veera Swamy, Professorm ECE, VCE
Learning System
• A learning system is a collection of data that are brought together in a way that
creates an environment for learning processes.
Designing a Learning System in Machine Learning :
• According to Tom Mitchell, “A computer program is said to be learning from
experience (E), with respect to some task (T). Thus, the performance measure (P)
is the performance at task T, which is measured by P, and it improves with
experience E.”
Example: In Spam E-Mail detection,
• Task, T: To classify mails into Spam or Not Spam.
• Performance measure, P: Total percent of mails being correctly classified as being
“Spam” or “Not Spam”.
• Experience, E: Set of Mails with label “Spam”
Example
As an example, assume that a total of 300 emails were used to evaluate a model.
These emails were hand-labeled as either Spam or Not Spam.

Accuracy=TP + TN/ TP + TN + FP + • Accuracy = (30+250)/300 = 0.933


FN
Steps for Designing Learning System
Choosing the Training Experience:Machine Learning
Algorithm will get more and more experience by passing
through more and more examples and hence its
performance will increase.
Choosing target function: The next important step is
choosing the target function. It means according to the
knowledge fed to the algorithm the machine learning will
choose Next Move function which will describe what type
of legal moves should be taken. While playing chess with
the opponent, when opponent will play then the machine
learning algorithm will decide what be the number of
possible legal moves taken in order to get success.
Choosing Representation for Target function: When Choosing Function Approximation Algorithm: An
the machine algorithm will know all the possible legal optimized move cannot be chosen just with the training
moves the next step is to choose the optimized move data. The training data had to go through with set of
using any representation i.e. using linear Equations, example and through these examples the training data
Hierarchical Graph Representation, Tabular form etc. will approximates which steps are chosen and after that
The Next Move function will move the Target move like machine will provide feedback on it. For Example :
out of these move which will provide more success rate. When a training data of Playing chess is fed to
For Example : while playing chess machine have 4 algorithm so at that time it is not machine algorithm will
possible moves, so the machine will choose that fail or get success and again from that failure or
optimized move which will provide success to it. success it will measure while next move what step
T=w0+w1x1+w2x2 should be chosen and what is its success rate. Weight
Update
Final Design: The final design is created at last when system goes from number of examples , failures and
success , correct and incorrect decision and what will be the next step etc. Example: Deep Blue is an
intelligent computer which is ML-based won chess game against the chess expert Garry Kasparov, and it
became the first computer which had beaten a human chess expert.
Machine Learning
Labels 5 8
Data

Training

Prediction
Or
Inference

Dr K.Veera Swamy, Professorm ECE, VCE


Machine Learning-Introduction

Like gardening

• Seeds = Algorithms
• Nutrients = Data
• Gardener = You
• Plants = Model

Dr K.Veera Swamy, Professorm ECE, VCE


Machine Learning-Introduction

Machine learning is about predicting the future based on the past.


-- Hal Daume III

Past Future

Training Model/ Testing Model/


Data Predictor Data Predictor

Dr K.Veera Swamy, Professorm ECE, VCE


Machine Learning-Introduction
-- Ethem Alpaydin -- Kevin P. Murphy -- Christopher M. Bishop -- Hal Daume III

• Machine • The goal of • The field of • Machine


learning is machine pattern learning is
programming learning is to recognition is about
computers to develop concerned predicting
optimize a methods that with the the future
performance can automatic based on the
criterion automatically discovery of past.
using detect regularities in
example data patterns in data through
or past data, and the use of
experience. then to use computer
the algorithms
uncovered and with the
patterns to use of these
predict future regularities
data or other to take
outcomes of actions.
interest.
Dr K.Veera Swamy, Professorm ECE, VCE
Machine Learning-Introduction

Definition

•It is the ability to learn


automatically and improve
from experience without
being explicitly programmed.
Dr K.Veera Swamy, Professorm ECE, VCE
1.jpg 2.jpg
Implementation-Matlab
test.jpg
3.jpg 4.jpg
clear all
clc
a1 = imread('1.jpg');
m1=mean2(a1);
a2 = imread('2.jpg');
m2=mean2(a2);
a3 = imread('3.jpg');
m3=mean2(a3);
First Second Test a4 = imread('4.jpg');
m4=mean2(a4);

X(1,1)=real(m1);
X(2,1)=real(m2);
X(3,1)=real(m3);
X(4,1)=real(m4);

Y(1,1)={'First'};
Y(2,1)={'First'};
Y(3,1)={'Second'};
Y(4,1)={'Second'};

Model ctree = fitctree(X,Y,'MinParentSize',3);


view(ctree) % text description
view(ctree,'mode','graph') % graphic
description

%Test
T1 = imread(‘test.jpg');
Decision tree for classification test=mean2(T1);
label1 = predict(ctree,test)
1 if x1<127.078 then node 2 elseif x1>=127.078 then node 3 else First
2 class = First
3 class = Second
label1 =
1×1 cell array
{'Second'} Dr K.Veera Swamy, Professorm ECE, VCE
Core Concepts
At the heart of Machine learning is knowing and using the data appropriately.

• Collecting the right data


1

• Cleaning the data


2

• Building models using certain key features obtained by


processing the data using machine learning algorithms
3 iteratively

• Making predictions based on the hypotheses from these


models
4
Dr K.Veera Swamy, Professorm ECE, VCE
Core Concepts

• Data is defined as facts and


Data statistics collected together for
reference or analysis.

Handling • Structured/unstructured

• Extract of Important information


Feature from data results feature vector.

Dr K.Veera Swamy, Professorm ECE, VCE


Core Concepts

Data Types

Categorical Ordinal Numeric

•Categorical (for example: Male, Female).


•Ordinal(Categories with a specific order-
Military Ranks, Movie Ratings. )
•Numeric (for example: 2.3, 3.1, 3.2, and so on).
Dr K.Veera Swamy, Professorm ECE, VCE
Core Concepts

Data Sets

Training Validation Testing

•The training dataset refers to the data examples that are used to
learn or build a classifier, for example.
•The validation dataset refers to the data examples that are verified
against the built classifier and can help tune the accuracy of the
output.
•The testing dataset refers to the data examples that help assess
the performance of the classifier.
Dr K.Veera Swamy, Professorm ECE, VCE
Core Concepts

Data acquisition Practical usage

Universal set
(unobserved)

Training set Testing set


(observed) Dr K.Veera Swamy, Professorm ECE, VCE
(unobserved)
Core Concepts
ML-Phases

Phase 2— Phase 3—
Phase 1—
Validation Application
Training Phase
Phase Phase
Phase 1—Training Phase: This is the phase where training data is used to train
the model by pairing the given input with the expected output. The output of
this phase is the learning model itself.

Phase 2—Validation Phase: This phase is to measure how good the learning
model that has been trained is and estimate the model properties, such as error
measures, recall, precision, and others. This phase uses a validation dataset,
and the output is a sophisticated learning model.

Phase 3—Application Phase: In this phase, the model is subject to the real-
world data for which the results need to be derived.
Dr K.Veera Swamy, Professorm ECE, VCE
Learning-Prediction
Data

Training Data Validation data

To build the model To Refine the model

ML Algorithm Model New Dataset


(learner)

Model Behavior
Training: While training for machine learning, you pass an algorithm with training data.
The learning algorithm finds patterns in the training data such that the input parameters
correspond to the target. The output of the training process is a machine learning model
which you can then use to make predictions. This process is also called “learning”.
Model: A machine learning model can be a mathematical representation of a real-world
process. To generate a machine learning model you will need to provide training data to a
machine learning algorithm to learn from.
Dr K.Veera Swamy, Professorm ECE, VCE
Algorithms Machine Learning

• Supervised learning ( )
Algorithm
– Structured prediction or structured (output) Problem Categories
Types
learning is an umbrella term for supervised machine
learning techniques that involves
predicting structured objects, rather than Classification Supervised

scalar discrete or real values


– Classification (discrete labels), Regression (real values)

Regression Unsupervised
Unsupervised learning ( )
– Clustering
– Probability distribution estimation Structured output Semi-supervised
– Finding association (in features)
– Dimension reduction
• Semi-supervised learning Clustering Reinforcement

• Reinforcement learning
– Decision making (robot, chess machine)
Association rule

Dimension
Dr K.Veera Swamy, Professorm ECE, VCE
Reduction
Machine learning structure
• Supervised learning

Dr K.Veera Swamy, Professorm ECE, VCE


Machine learning structure
• Unsupervised learning

Dr K.Veera Swamy, Professorm ECE, VCE


Supervised learning

Dr K.Veera Swamy, Professorm ECE, VCE


Unsupervised learning

Dr K.Veera Swamy, Professorm ECE, VCE


Reinforcement learning

Dr K.Veera Swamy, Professorm ECE, VCE


Baby Learning

Unsupervised Reinforcement
Supervised

4
4
Algorithms
Supervised Unsupervised

Discrete Classification Clustering

Continuous
Dimensionality
Regression
reduction

Dr K.Veera Swamy, Professorm ECE, VCE


Machine Learning-Algorithms

Label

Present Absent
(SL) (USL)

Discrete Continuous Discrete Continuous


(Classification) (Regression) (Clustering) (DR)

Dr K.Veera Swamy, Professorm ECE, VCE


Models

Models

Logical Geometric Probabilistic

Model describes data that is observed in a system.


Models are the output of algorithms applied to a
dataset. In many cases, these models are applied to new
datasets that help the models learn new behaviour and
also predict them. Dr K.Veera Swamy, Professorm ECE, VCE
Models
Logical models : Logical models are more algorithmic in nature and help us
derive a set of rules by running the algorithms iteratively. Logical models are
defined in terms of easily interpretable logical expressions.
Example: Decision Trees, Association rules

Geometric models : Geometric models use geometric concepts such as lines,


planes, and distances. These models usually operate, or can operate, on high
volumes of data. Usually, linear transformations help compare different
Machine learning methods.
Example: Support Vector Machine, Linear Classifiers, K-Means, K-NN

Probabilistic models: Probabilistic models view learning as a process of reducing


uncertainty, modeled by means of probability distributions. Probabilistic
models are statistical models that employ statistical techniques. These models
are based on a strategy that defines the relationship between two variables.
This relationship can be derived for sure as this involves using a random
background process. In most cases, a subset of the overall data can be
considered for processing.
Example: Bayes, Gaussian Mixture Modeling(GMM)
Dr K.Veera Swamy, Professorm ECE, VCE
AI-ML-DL

Artificial
Intelligence

Machine
Learning

Neural
Networks

Deep Learning

Dr K.Veera Swamy, Professorm ECE, VCE


AI-ML-DL
AI: Engineering of making intelligent machines and programs. Any technique that
enables computers to mimic human intelligence, are using logic, if then rules,
decision trees, and machine learning including deep learning.

ML: Ability to learn without explicitly programmed. A subset of AI that includes


complex statistical techniques that enables machines to improve at tasks with
experience. The category includes deep learning.

Neural Networks: Neural networks are a set of algorithms, modeled loosely after
the human brain, that are designed to recognize patterns. They interpret sensory
data through a kind of machine perception , labeling or clustering raw input. The
patterns they recognize are numerical, contained in vectors, into which all real-
world data, be it images, sound , text or time series, must be translated.

DL: Learning based on deep neural network. The subset of machine learning
composed of algorithms that permit software to train itself to perform tasks, like
speech and image recognition, by exposing multilayered neural networks to vast
amounts of data.
Dr K.Veera Swamy, Professorm ECE, VCE
Artificial Intelligence
Reasoning
Machine Learning
Natural
Language
Processing

Supervised Unsupervised Semi-supervised Reinforcement


Learning Learning Learning Learning

Planning

Dr K.Veera Swamy, Professorm ECE, VCE


Data Inconsistencies

Data
Inconsistencies

Unpredictable
Under-fitting Over-fitting Data Instability
Future

Dr K.Veera Swamy, Professorm ECE, VCE


Under-fitting
It doesn't take into consideration enough information to accurately model
the actual data. It usually happens when we have less data to build an
accurate model and also when we try to build a linear model with a non-
linear data. In such cases the rules of the machine learning model are too
easy and flexible to be applied on such a minimal data and therefore the
model will probably make a lot of wrong predictions. A statistical model or a
machine learning algorithm is said to have under-fitting when it cannot
capture the underlying trend of the data. Under-fitting destroys the
accuracy of our machine learning model. Its occurrence simply means that
our model or the algorithm does not fit the data well enough. Under-fitting
occurs if the model or algorithm shows low variance but high bias.

Example: It’s just like trying to fit undersized pants.

Dr K.Veera Swamy, Professorm ECE, VCE


Over-fitting

It occurs when a model learns the detail and noise in the training data to the
extent that it negatively impacts the performance of the model on new data.
Over-fitting usually occurs when the statistical model describes noise instead of
describing the relationships. A statistical model is said to be over-fitted, when
we train it with a lot of data . When a model gets trained with so much of data,
it starts learning from the noise and inaccurate data entries in our data set.

Example: Just like fitting ourselves in an oversized pants.

Dr K.Veera Swamy, Professorm ECE, VCE


Data Inconsistencies

Over-fitting Under-fitting Normal- fitting

Dr K.Veera Swamy, Professorm ECE, VCE


Under-fitting Appropriate-fitting Over-fitting

Dr K.Veera Swamy, Professorm ECE, VCE


What is bias?
Bias is the difference between the average prediction of our model
and the correct value which we are trying to predict. Model with
high bias pays very little attention to the training data and
oversimplifies the model. It always leads to high error on training
and test data.
What is variance?
Variance is the variability of model prediction for a given data point
or a value which tells us spread of our data. Model with high
variance pays a lot of attention to training data and does not
generalize on the data which it hasn’t seen before. As a result, such
models perform very well on training data but has high error rates
on test data.

Dr K.Veera Swamy, Professorm ECE, VCE


Techniques to reduce under-fitting : High bias and low variance
1. Increase model complexity
2. Increase number of features, performing feature engineering
3. Remove noise from the data.
4. Increase the number of epochs or increase the duration of training to
get better results.
Techniques to reduce over-fitting :High variance and low bias
1. Reduce model complexity.
2. Remove Features
3. Early stopping during the training phase (have an eye over the loss over the
training period as soon as loss begins to increase stop training).
4. Ridge Regularization and Lasso Regularization
5. Use dropout for neural networks to tackle over-fitting.

Dr K.Veera Swamy, Professorm ECE, VCE


Over Fitting-
Underfitting

Total Error = Bias²+ Variance + Irreducible


Error

Dr K.Veera Swamy, Professorm ECE, VCE


Unstable Data & Unpredictable future
Unstable data: Machine learning algorithms do their best to avoid unstable data
by minimizing outliers, but what if the errors were our own fault? If we are
misrepresenting what is correct data, then we will end up skewing our results.

Unpredictable future: Machine learning is well suited for the unpredictable


future, because most algorithms learn from new information. But as new
information is found, it can also come in unstable forms, and new issues can arise
that weren’t thought of before. We don’t know what we don’t know. When
processing new information, it’s sometimes hard to tell whether our model is
working or not.

Dr K.Veera Swamy, Professorm ECE, VCE


Types of Learning Problems
Machine Learning

Algorithm
Problem Categories
Types

Classification Supervised

Regression Unsupervised

Structured output Semi-supervised

Clustering Reinforcement

Association rule

Dimension
Dr K.Veera Swamy, Professorm ECE, VCE
Reduction
Problem Categories

Supervised Unsupervised

Structured Association Dimension


Classification Regression Clustering
Output rule reduction

Dr K.Veera Swamy, Professorm ECE, VCE


Classification
Classification: Predicting a label.
Examples:
•This mail is spam or not?
•Will it rain today or not?
•Is this picture a cat or not?

Classification: Classification is a way to identify a grouping


technique for a given dataset in such a way that
depending on a value of the target or output attribute,
the entire dataset can be qualified to belong to a class.
This technique helps in identifying the data behavior
patterns. This is, in short, a discrimination mechanism.
Dr K.Veera Swamy, Professorm ECE, VCE
Classification
Example: Customer is good or bad (Good-Who spend
more than 1 Lakh, Bad- Who spend less than 1 Lakh).

Now when new customer data comes in, the sales


manager can plot the new customers on graph and based
on which side they fall, predict whether the customer is
likely to be good or bad.

Note that classification need not always be binary (yes or


no, male or female, good or bad, and so on) and any
number of classifications can be defined (poor, below
average, average, above average, good) based on the
problem definition.
Dr K.Veera Swamy, Professorm ECE, VCE
Regression
Regression: Predicting a quantity.
Examples:
•What is the price of house in a specific city?
•What is the value of the stock?
•How many total runs can be on board in a cricket game?

Regression: Similar to classification, forecasting or


prediction is also about identifying the way things would
happen in the future. This information is derived from
past experience or knowledge. In some cases, there is not
enough data, and there is a need to define the future
through regression.
Dr K.Veera Swamy, Professorm ECE, VCE
Regression
Example: An agricultural scientist working on a new crop
that she developed. As a trial, this seed was planted at
various altitudes and the yield was computed. The
requirement here is to predict the yield of the crop given
the altitude details (and some more related data points).
The relationship between yield gained and the altitude is
determined by plotting a graph between the parameters.
An equation is noted that fits most of the data points, and
in cases where data does not fit the curve, we can get rid
of the data. This technique is called regression.

Dr K.Veera Swamy, Professorm ECE, VCE


Classification Vs Regression

Pass or Fail
Student Profile Classification

Percentage
Student Profile Regression

Dr K.Veera Swamy, Professorm ECE, VCE


Structured Output:
Structured Output: Structured prediction or structured
output is an umbrella term for supervised machine
learning techniques that involves predicting structured
objects, rather than scalar discrete or real values.
Similar to commonly used supervised learning techniques,
structured prediction models are typically trained by
means of observed data in which the true prediction value
is used to adjust model parameters.

Example: Natural Language Processing, Speech


Recognition

Dr K.Veera Swamy, Professorm ECE, VCE


Clustering
Clustering: It is the task of grouping a set of objects in
such a way that objects in the same group is more similar
to each other than to those in other groups. Clustering is a
classification analysis that does not start with a specific
target in mind.

Example: Grouping customers by purchasing behaviour

Clustering is the task of dividing the population or data


points into a number of groups. Data points in the same
groups are more similar to other data points in the same
group and dissimilar to the data points in other groups. It
is basically a collection of objects on the basis of similarity
and dissimilarity between them.
Dr K.Veera Swamy, Professorm ECE, VCE
Red dots Green dots

Intra Cluster
distances are
Inter Cluster minimized
distances are
maximized

Black dots

Dr K.Veera Swamy, Professorm ECE, VCE


Association
Association: It finds association and relationships among
large sets of data items. An association rule learning
problem is where you want to discover rules that describe
large portions of data.
Example: People that buy X also tends to buy Y.

Association Rule is a rule-based machine learning method


for discovering interesting relations between variables in
large databases. It is intended to identify strong rules
discovered in databases using some measures of
interestingness.
Example: If a customer buys onions and potatoes
together, they are likely to also buy meat.
Dr K.Veera Swamy, Professorm ECE, VCE
Dimension Reduction
Matrix decomposition techniques are often used for dimensionality reduction.

Feature extraction: This reduces the data in a high dimensional space to a


lower dimension space, i.e. a space with lesser no. of dimensions.

Methods of Dimensionality Reduction


The various methods used for dimensionality reduction include:
Principal Component Analysis (PCA)
Linear Discriminant Analysis (LDA)
Generalized Discriminant Analysis (GDA)

Example: Assume you have constructed a bag-of-words from each email, and
as a result you have a sample of bag-of-words vectors x1…. xm. For a
mathematical way to reduce dimension we will use PCA.

Dr K.Veera Swamy, Professorm ECE, VCE


Algorithm Types Machine Learning

Algorithm
Types

Supervised

Unsupervised

Semi-supervised

Reinforcement
Dr K.Veera Swamy, Professorm ECE, VCE
Supervised Learning
Supervised learning as the name indicates the presence of a
supervisor. Basically supervised learning is a learning in which
we train the machine using data which is well labelled that
means some data is already tagged with the correct answer.

Example : If shape of object is rounded and colour is red then


it will be labelled as Apple. If shape of object is curving
cylinder and colour is green-yellow then it will be labelled as
Banana. Now suppose after training the data, you have given
a new separate fruit say Banana from basket and asked to
identify it.

Dr K.Veera Swamy, Professorm ECE, VCE


Supervised learning: classification

label
apple

apple
Classification: a finite set of
labels
banana

banana

Supervised learning:
Dr K.Veera Swamy, Professorm ECE,given
VCE labeled examples
Supervised learning: regression
label

-4.5

10.1 Regression: label is real-valued

3.2

4.3

Supervised learning:
Dr K.Veera Swamy, Professorm ECE,given
VCE labeled examples
Supervised learning: ranking

label
1

Ranking: label is a ranking


4

Supervised learning:
Dr K.Veera Swamy, Professorm ECE,given
VCE labeled examples
Unsupervised Learning
Unsupervised learning is the training of machine using
information that is neither classified nor labeled and allowing
the algorithm to act on that information without guidance.
Here the task of machine is to group unsorted information
according to similarities, patterns and differences without any
prior training of data. Unlike supervised learning, no training
will be given to the machine. Machine is restricted to find the
hidden structure in unlabeled data by it-self.

Example : Suppose it is given an image having fruits which


have not seen ever. Thus the machine has no idea about the
features of fruits. Select one characteristic such as colour.
Then fruits are arranged on the basis of colour.
Dr K.Veera Swamy, Professorm ECE, VCE
Unsupervised learning

Unupervised learning: given data, i.e. examples, but no labels


Dr K.Veera Swamy, Professorm ECE, VCE
Semi-supervised Learning
Semi-supervised learning is about using both labeled and
unlabeled data to learn models better. A small amount of
labeled data with a large amount of unlabeled data is used
during training phase. It quickly builds models based on
labeled data and applies to unlabeled data.

Example: Photo archive- Some of the images are labeled, (e.g.


dog, cat, horse) and the majority are unlabeled.

Dr K.Veera Swamy, Professorm ECE, VCE


Reinforcement Learning
RL is about taking suitable action to maximise reward in a
particular situation. It is the concept that the optimal
behaviour or action is reinforced by a positive reward.

Agent

State Reward Action

Environment

Example : Autonomous Vehicles

Dr K.Veera Swamy, Professorm ECE, VCE


Deep Learning
Deep learning allows computational models that are
composed of multiple processing layers to learn
representations of data with multiple levels of abstraction.
Deep learning discovers intricate structure in large data sets
by using the back propagation algorithm to indicate how a
machine should change its internal parameters that are used
to compute the representation in each layer from the
representation in the previous layer. Deep learning is the
combination Artificial Neural Networks (ANN), Recurrent
Neural Networks (RNN), and Convolution Neural Networks
(CNN).

Example:Human brain
Dr K.Veera Swamy, Professorm ECE, VCE
Deep Learning

Dr K.Veera Swamy, Professorm ECE, VCE


ML Architecture

/Tuning
collection/Training

Experimentation/Testing
ERP/Main frame/IOT

Preprocessing/Sample
Data Data Evaluation
Acquisition Processing

Feedback

Modeling
Deployment
-
ML Algorithms

Dr K.Veera Swamy, Professorm ECE, VCE


• The first move toward defining the architecture is defining the problem
statement, which includes defining the goal, process, and assumptions. Identify
whether it is a classification, regression, or optimization problem?

• Data Acquisition: Acquire the raw data and store in the database.
• Data Processing: Preprocess the data as per the requirement (Cleaning the
data). The quality of the data and the useful information that can be derived
from it directly affects the ability of the model to learn. Useful information is
generated using sample collection.
• Modeling: Model parameters are learned directly from training data. Model
parameters are learned attributes that define the individual model. Hence,
model is built using training data. Machine learning algorithms are developed in
this phase.
• Evaluation: Evaluate each model in this phase using testing data. If you test the
model on the same data used to train it leads to over-fitting. Hence training
data and testing data should be separated.
• Deployment: All machine learning models are kept into production in this
phase. These models are applied for other applications also. Performance
feedback is carried to improve the models further.
Dr K.Veera Swamy, Professorm ECE, VCE
ML | Linear Regression vs Logistic Regression

Dr K.Veera Swamy, Professorm ECE, VCE


Regression & Classification

Dr K.Veera Swamy, Professorm ECE, VCE


Regression & Classification

Dr K.Veera Swamy, Professorm ECE, VCE


ML | Linear Regression vs Logistic Regression

Linear Regression is a machine learning algorithm


based on supervised regression algorithm.
Regression models a target prediction value based on
independent variables. It is mostly used for finding
out the relationship between variables and
forecasting. Different regression models differ based
on – the kind of relationship between the dependent
and independent variables, they are considering and
the number of independent variables being used.

Dr K.Veera Swamy, Professorm ECE, VCE


ML | Linear Regression vs Logistic Regression

Logistic regression is basically a supervised


classification algorithm. In a classification
problem, the target variable(or output), Y, can
take only discrete values for a given set of
features(or inputs), X.

Dr K.Veera Swamy, Professorm ECE, VCE


ML | Linear Regression vs Logistic Regression
Linear Regression Logistic Regression

Linear Regression is a supervised Logistic Regression is a supervised


regression model. classification model.
In Linear Regression, we predict the In Logistic Regression, we predict the
value by an integer number. value by 1 or 0.
Here no activation function is used. Here activation function is used.

Here no threshold value is needed. Here a threshold value is added.


Linear regression is used to estimate the Whereas logistic regression is used to
dependent variable in case of a change calculate the probability of an event. For
in independent variables. For example, example, classify if tissue is benign or
predict the price of houses. malignant.

Dr K.Veera Swamy, Professorm ECE, VCE


Linear Regression

Dr K.Veera Swamy, Professorm ECE, VCE


Linear Regression with One variable

Dr K.Veera Swamy, Professorm ECE, VCE


Linear Regression with One variable

Dr K.Veera Swamy, Professorm ECE, VCE


Linear Regression with One variable

Dr K.Veera Swamy, Professorm ECE, VCE


Dr K.Veera Swamy, Professorm ECE, VCE
Dr K.Veera Swamy, Professorm ECE, VCE
Dr K.Veera Swamy, Professorm ECE, VCE
Dr K.Veera Swamy, Professorm ECE, VCE
Hypothesis
hw  X   w0  w1 X
wi 's : Parameters How to choose wi 's :

Dr K.Veera Swamy, Professorm ECE, VCE


Dr K.Veera Swamy, Professorm ECE, VCE
Cost Function

Idea: Choose w0 , w1 so that hw  X  is close to Y for our training


examples (X,Y)

Dr K.Veera Swamy, Professorm ECE, VCE


Conclusion
Hypothesis: hw  X   w0  w1 X

Parameters: w0 , w1

Cost Function:

Goal:

Dr K.Veera Swamy, Professorm ECE, VCE


Linear Regression with One Variable-
Gradient Descent
Have Some Function : J w0 , w1 

Want: min J w0 , w1 


w0 , w1

Outline:
•Start with some w0 , w1

•Keep Changing w0 , w1 to reduce J w0 , w1  until we


hopefully end up a minimum

Dr K.Veera Swamy, Professorm ECE, VCE


Linear Regression with One Variable-
Gradient Descent

w0 , w1 J w0 , w1 

Dr K.Veera Swamy, Professorm ECE, VCE


Gradient Descent

Dr K.Veera Swamy, Professorm ECE, VCE


Learning Rate

Learning rate is a hyper-parameter that


If Learning Rate is too large,
controls how much we are adjusting the
gradient descent can overshoot the
weights of our network with respect the loss
gradient. The lower the value, the slower we minimum. It may fail to converge,
travel along the downward slope. While this or even diverge.
might be a good idea (using a low learning
rate) in terms of making sure that we do not
miss any local minima, it could also mean that
a long time to converge .
If Learning Rate is too small, gradient
descent is slow.
Dr K.Veera Swamy, Professorm ECE, VCE
Dr K.Veera Swamy, Professorm ECE, VCE
Example

Answer:
Example

• Answer:
Dr K.Veera Swamy, Professorm ECE, VCE
Example

• Answer:

Dr K.Veera Swamy, Professorm ECE, VCE


Gradient Descent-Optimisation

Dr K.Veera Swamy, Professorm ECE, VCE


Gradient Descent Example

Dr K.Veera Swamy, Professorm ECE, VCE


Dr K.Veera Swamy, Professorm ECE, VCE
Dr K.Veera Swamy, Professorm ECE, VCE
Dr K.Veera Swamy, Professorm ECE, VCE
Dr K.Veera Swamy, Professorm ECE, VCE
Summary

Dr K.Veera Swamy, Professorm ECE, VCE


Dr K.Veera Swamy, Professorm ECE, VCE
Linear Regression with Multiple
variables

Dr K.Veera Swamy, Professorm ECE, VCE


Polynomial Regression

Dr K.Veera Swamy, Professorm ECE, VCE


Logistic Regression-Classification

Dr K.Veera Swamy, Professorm ECE, VCE


Example: Take 2 classes, 1 — DOG , 2 —CAT

We basically decide with a threshold value above which


we classify values into Class 1 and of the value goes
below the threshold then we classify it in Class 2. As
shown in the above graph we have chosen the threshold
as 0.5, if the prediction function returned a value of 0.7
then we would classify this observation as Class
1(DOG). If our prediction returned a value of 0.2 then
we would classify the observation as Class 2(CAT).
Dr K.Veera Swamy, Professorm ECE, VCE
Dr K.Veera Swamy, Professorm ECE, VCE
Feature Scaling
Idea: Make sure features are on a similar
scale
E.g. X1=size (0--‐2000 feet2)
X2=number of bedrooms (0 to 4)

X1=size of bed room/2000


X2=number of bed rooms/4

Mean normalization:
X1=(size of bed room-1000)/2000
X2=(number of bed rooms-2)/4
Dr K.Veera Swamy, Professorm ECE, VCE
ML Applications-Image Recognition

Image Recognition is one of the most significant Machine Learning and


artificial intelligence examples. Basically, it is an approach for identifying and
detecting a feature or an object in the digital image. Moreover, this technique
can be used for further analysis, such as pattern recognition, face detection,
face recognition, optical character recognition, and many more. Though
several techniques are available, using a machine learning approach for image
recognition is preferable. In a machine learning approach for image-
recognition is involved extracting the key features from the image and
therefore input these features to a machine learning model.
Dr K.Veera Swamy, Professorm ECE, VCE
ML Applications- News Classification

News classification is another benchmark application of a machine learning


approach. Why or How? As a matter of fact that now the volume of information
has grown tremendously on the web. However, every person has his individual
interest or choice. So, to pick or gather a piece of appropriate information
becomes a challenge to the users from the ocean of this web. Providing that
interesting category of news to the target readers will surely increase the
acceptability of news sites. Moreover, readers or users can search for specific
news effectively and efficiently. There are several methods of machine learning
in this purpose, i.e., support vector machine, naive Bayes, k-nearest neighbor,
etc. Moreover, there are several “news
Dr K.Veera ECE, VCE software” is available.
classification
Swamy, Professorm
ML Applications- Video Surveillance

A small video file contains more information compared to others. For this reason,
extracting useful information from video, i.e., the automated video surveillance
system has become a hot research issue. With this regard, video surveillance is
one of the advanced applications of a machine learning approach. In the security-
based application, identification of the human from the videos is an important
issue. The face pattern is the most widely used parameter to recognize a person.
A system with the ability to gather information about the presence of the same
person in a different frame of a video is highly demanding. There are several
methods of machine learning algorithm to track the movement of human and
identifying them. Dr K.Veera Swamy, Professorm ECE, VCE
ML Applications- Email Classification
and Spam Filtering

To classify email and filter the spam in an automatic way ML algorithm is


employed. There are many techniques, i.e., multi-layer perception, C4.5
decision tree induction, are used to filter the spam. The rule-based spam
filtering has some drawbacks to filter the spam, whereas spam filtering using
the ML approach is more efficient.
Dr K.Veera Swamy, Professorm ECE, VCE
ML Applications- Speech Recognition

At present, all commercial purpose speech recognition system uses a machine


learning approach to recognize the speech. Why? The speech recognition system
using machine learning approach outperforms better than the speech
recognition system using a traditional method. Because, in a machine learning
approach, the system is trained before it goes for the validation. Basically, the
machine learning software of speech recognition works two learning phases:
1. Before the software purchase (train the software in an independent speaker
domain)
2. After the user purchases the software (train the software in a speaker
dependent domain). Dr K.Veera Swamy, Professorm ECE, VCE
ML Applications- Online Fraud Detection

Online fraud detection is an advanced application of machine learning


algorithm. This approach is practical to provide cybersecurity to the users
efficiently. Recently, PayPal is using a machine learning and artificial intelligence
algorithm for money laundering. This advanced machine learning and artificial
intelligence example helps to reduce the loss and maximize the profit. Using
machine learning in this application, the detection system becomes robust than
any other traditional rule-based system.

Dr K.Veera Swamy, Professorm ECE, VCE


ML Applications- Recommendation
(Products and Services)

Suppose that; we purchased several things from an online shop several days
before. After a couple of days, you will notice that the related shopping websites
or services are recommended for you. Again, if you search something in google
therefore after your searching, the similar type of things are recommended for
you. This recommendation of products and services are the advance application of
machine learning technique . Several machine learning methods like supervised,
semi-supervised, unsupervised, reinforcement are used to develop these products
recommendation based system. This type of system also built with the
Dr K.Veera Swamy, Professorm ECE, VCE
incorporation of big data and ML technique.
ML Applications- Online Customer
Support

Recently almost all websites allow the customer to chat with the website
representative. However, not website has an executive. Basically, they develop a
chat-bot to chat with the customer to know their opinion. This is possible only for
the machine learning approach. It’s just a beauty of machine learning algorithm.

Dr K.Veera Swamy, Professorm ECE, VCE


ML Applications- Language
Identification

Language identification (Language Guessing) is the process of identifying the type


of language. Apache OpenNLP, Apache Tika is the language identifying
software. There are several approaches to identify the language. Among these,
the machine learning and artificial intelligence approach is efficient.

Dr K.Veera Swamy, Professorm ECE, VCE


ML Applications- Robot Control

A machine learning algorithm is used in a variety of robot control system. For


instance, recently, several types of research have been working to gain control
over stable helicopter flight and helicopter aerobatics. In Darpa-sponsored
competition, a robot driving for over one hundred miles within the desert was
won by a robot that used machine learning to refine its ability to notice distant
Dr K.Veera Swamy, Professorm ECE, VCE
objects.
ML Applications- Classification

Classification or categorization is the process of classifying the objects or


instances into a set of predefined classes. The use of machine learning
approach makes a classifier system more dynamic. The goal of the ML approach
is to build a concise model. This approach is to help to improve the efficiency of
a classifier system.
Dr K.Veera Swamy, Professorm ECE, VCE
ML Applications-
Prediction
Prediction is the process of saying
something based on previous history.
It can be weather prediction, traffic
prediction, and may more. All sort of
forecasts can be done using a
machine learning approach. There are
several methods like Hidden Markov
model can be used for prediction.

Dr K.Veera Swamy, Professorm ECE, VCE


ML Applications- Regression

Classification or categorization is the process of classifying the objects or


instances into a set of predefined classes. The use of machine learning
approach makes a classifier system more dynamic. The goal of the ML approach
is to build a concise model. This approach is to help to improve the efficiency of
a classifier system.
Dr K.Veera Swamy, Professorm ECE, VCE
ML Applications- Social Media

Social media is using the machine learning approach to create attractive and
splendid features, i.e. people you may know, suggestion, react options for their
users. These features are just an outcome of the machine learning technique. Do
you ever think of how they use the machine learning approach to engage you in
your social account? For example, Facebook continuously notices your activities
like with whom you chat, your likes, workplace, study place. And machine
learning always acts based on experience. So, Facebook gives you a suggestion
based on your activities. Dr K.Veera Swamy, Professorm ECE, VCE
ML Applications- Information retrieval

The most significant machine learning and AI approach is information retrieval. It


is the process of extracting the knowledge or structured data from the
unstructured data. Since, now, the availability of information has been grown
tremendously for web blogs, website, and social media. Information retrieval
plays a vital role in the big data sector. In a machine learning approach, a set of
unstructured data is taken for input and therefore extracts the knowledge from
the data.
Dr K.Veera Swamy, Professorm ECE, VCE
ML Applications- CBIR

Content-based image retrieval, also known as query by image content (QBIC)


and content-based visual information retrieval (CBVIR), is the application
of computer vision techniques to the image retrieval problem, that is, the problem
Dr K.Veera Swamy, Professorm ECE, VCE
of searching for digital images in large databases
ML Applications- Image Segmentation

Image segmentation is the process of partitioning a digital image into multiple


segments (sets of pixels, also known as image objects). The goal of segmentation
is to simplify and/or change the representation of an image into something that is
more meaningful and easier to analyze. Image segmentation is typically used to
locate objects and boundaries (lines, curves, etc.) in images. More precisely,
image segmentation is the process of assigning a label to every pixel in an image
such that pixels with the same label share certain characteristics.

Dr K.Veera Swamy, Professorm ECE, VCE


ML Applications- Medical Diagnosis

ML provides methods, techniques, and tools that can help in solving diagnostic
and prognostic problems in a variety of medical domains. It is being used for the
analysis of the importance of clinical parameters and of their combinations for
prognosis, e.g. prediction of disease progression, for the extraction of medical
knowledge for outcomes research, for therapy planning and support, and for
overall patient management.
Dr K.Veera Swamy, Professorm ECE, VCE
ML Applications- Travelling-Traffic Prediction

I am sure you hate traffic jams!!! And to solve some of these problems related
to traveling, Machine Learning is a big help. One of the common examples of
ML in traveling is Google Maps. The algorithm for Google Maps automatically
picks the best route from point A to point B, by relying on the projections of
different timeframes and keeping in mind various factors like traffic jams,
roadblocks, etc. Also, the names of various streets and locations are read in
Street View and then added to Google Maps for optimal accuracy.

Dr K.Veera Swamy, Professorm ECE, VCE


ML Applications- Weather Forecast

Data collection and processing


1. Linear regression models
2. Neural network models

Dr K.Veera Swamy, Professorm ECE, VCE


ML Applications- Virtual Personal
Assistants

As the name suggests, Virtual Personal Assistants assist in finding useful


information, when asked via text or voice. Few of the major Applications of
Machine Learning here are:
•Speech Recognition
•Speech to Text Conversion
•Natural Language Processing
•Text to Speech Conversion

Dr K.Veera Swamy, Professorm ECE, VCE


ML Applications- Driverless Cars

ALVINN
Drives 70 mph on a public highway Predecessor of the Google car

https://www.youtube.com/watch?v=aaOB-ErYq6Y

Dr K.Veera Swamy, Professorm ECE, VCE


Driverless Cars

Google Car Mercedes-Benz

Nissan Car
Dr K.Veera Swamy, Professorm ECE, VCE
Reference: https://data-flair.training/blogs/machine-learning-applications/

Dr K.Veera Swamy, Professorm ECE, VCE


References
1. Machine Learning for Big Data :Hands on for
developers and technical professionals wiley
publications, 2018 by Jason Bell.

2. Practical Machine Learning. Sunila Gollapudi,


Packt publishers, 2016.

3.Introduction to Machine Learning, Ethem


Alpaydin, third edition, PHI

4. Internet
Dr K.Veera Swamy, Professorm ECE, VCE

You might also like