ML Session 1
ML Session 1
2
Introduction
Data
Computer Output
Machine learning program
Traditional Programming chart
It’s an application of AI
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
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.
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:
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
𝑛
𝑖 𝑖
𝑎𝑜 = 𝑎𝑜 − 𝑎 . 𝐷𝑎𝑜 𝑎1 = 𝑎1 − 𝑎 . 𝐷𝑎1
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!