0% found this document useful (0 votes)
23 views22 pages

ML Session 1

The document provides an agenda for a machine learning diploma course. It includes reviewing different machine learning types like supervised, unsupervised and reinforcement learning. It also discusses the key differences between classification and regression problems. Additionally, it covers the concepts of linear regression, including defining the cost function and gradient descent method. Gradient descent is used to minimize the cost function and find the optimal values for parameters in linear regression.
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)
23 views22 pages

ML Session 1

The document provides an agenda for a machine learning diploma course. It includes reviewing different machine learning types like supervised, unsupervised and reinforcement learning. It also discusses the key differences between classification and regression problems. Additionally, it covers the concepts of linear regression, including defining the cost function and gradient descent method. Gradient descent is used to minimize the cost function and find the optimal values for parameters in linear regression.
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/ 22

Machine Learning Diploma

Level3: Machine Learning


Session1
Agenda
➔ Review for different types of Machine Learning
➔ Classification Vs Regression
➔ Linear Regression
➔ Gradient Descent and Cost Function
➔ Implementation of Linear Regression

2
Introduction
Data
Computer Output
Machine learning program
Traditional Programming chart
 It’s an application of AI

 Computers observe and analyze Data


Computer program
Output
 Predict based on previous patterns

Machine learning chart

3
1. Review for different types of Machine Learning

4
5
Definition:
➔ Machine learning is a field of data science that focuses on designing
algorithms that can learn from and make predictions on data.
➔ Machine Learning Types:
- Supervised Learning
- Unsupervised Learning
- Reinforcement Learning

6
Supervised learning unsupervised learning

Supervised learning, an AI system is Supervised learning, AI system is presented


presented with data which is labeled, with unlabeled, uncategorized data and the
which means that each data tagged with system’s algorithms act on the data without
the correct label. prior training.

7
Reinforcement learning
Reinforcement learning is a type of machine learning in which a computer learns to
perform a task through repeated trial-and-error interactions with a dynamic environment.

8
2. Classification Vs Regression

9
Regression:
➔ Regression is a technique to model output value with the help of
independent predictors.
➔ Regression is used to predict a relationship between a dependent
variable and independent variables.
Regression Problem try to learn the real numerical value of the class,
such as “dollars” or “weight” or “size”.

10
Classification:
➔ Classification is a supervised learning concept which basically categorizes
a set of data into classes.
➔ It is a predictive modelling problem where a class label is predicted for a
given example of input data.

Classification problem try to learn categorical class.


such as “red” or “blue” or “yellow”

11
3. Linear Regression

12
Linear Regression:
➔ Linear Regression describes a linear relationship between an
independent variable and the dependent variable.
➔ The main idea is to predict the best fit line with the help of given data
points.
➔ The best fit line will have minimum
error depicted by the distance
between the points and the line.

Y = a0 + a1 X

13
4. Gradient Descent and Cost Function

14
Cost Function:
➔ Cost Function helps us to get the best values for a0 and a1, in order to get
the best fit line for data points.
➔ The difference between the predicted values and the actual values gives
the error.
➔ We want to minimize this error
“mean squared error function”

15
Cost Function (evaluation metrics ) for Regression example:

➔ Mean squared Error (MSE)

➔ Mean absolute Error (MAE)

16
Gradient Descent:
➔ Gradient Descent helps us to reduce the cost function to reach minima.
➔ Start with some values of a0 and a1.
➔ Change them iteratively until reaching a minimum for cost function J.

➔ Learning Rate α determines how fast we are going to reach the minima.

17
Gradient Descent:
➔ To calculate these steps or gradients from cost function, we take
gradients (partial derivatives) of a0 and a1. A little bit of calculus will do
the trick here.
➔ Higher learning rate means less time but with a chance of missing the
minima and vice versa for the lower learning rate.

18
Gradient Descent find new a0 and a1 : 𝑦𝑝𝑟𝑒𝑑𝑖𝑐𝑡 = 𝑎0 + 𝑎1 . 𝑥
1 𝑛 1 𝑛
𝑗 = ෍ (𝑝𝑟𝑒𝑑𝑖𝑐𝑡𝑖 − 𝑦𝑖 )2
𝑛
= 𝑗 = ෍ ( 𝑎0 + 𝑎1 . 𝑥 − 𝑦𝑖 )2
𝑛
𝑖 𝑖

Apply differentiation on j twice for 𝑎𝑜 and 𝑎1 to get 𝐷𝑎𝑜 and 𝐷𝑎1


2 𝑛 2 𝑛
𝐷𝑎𝑜 = ෍ (𝑝𝑟𝑒𝑑𝑖𝑐𝑡𝑖 − 𝑦𝑖 ) 𝐷𝑎1 = ෍ 𝑝𝑟𝑒𝑑𝑖𝑐𝑡𝑖 − 𝑦𝑖 . 𝑥
𝑛 𝑖=1 𝑛 𝑖=1

𝑎𝑜 = 𝑎𝑜 − 𝑎 . 𝐷𝑎𝑜 𝑎1 = 𝑎1 − 𝑎 . 𝐷𝑎1

new 𝑎0 old 𝑎0 Learning rate new 𝑎1 old 𝑎1 Learning rate

repeat this for number of epochs


19
Gradient Descent:

20
Gradient Descent:
➔ If α is too small, gradient descent can be slow.
➔ If α is too large, gradient descent can overshoot the minima. It may
fail to converge, or even diverge.

a1
a0
21
THANK YOU!

You might also like