0% found this document useful (0 votes)
37 views42 pages

AI Lec5

This document provides an overview of regression analysis and linear regression. It defines regression analysis as a predictive modeling technique used to investigate relationships between dependent and independent variables. Linear regression establishes a linear relationship between dependent and independent variables using a best fit line. The document discusses obtaining the best fit line using the least squares method and gradient descent. It also covers cost functions, multivariate linear regression, and using the normal equation method to solve for parameters.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views42 pages

AI Lec5

This document provides an overview of regression analysis and linear regression. It defines regression analysis as a predictive modeling technique used to investigate relationships between dependent and independent variables. Linear regression establishes a linear relationship between dependent and independent variables using a best fit line. The document discusses obtaining the best fit line using the least squares method and gradient descent. It also covers cost functions, multivariate linear regression, and using the normal equation method to solve for parameters.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Artificial Intelligence

CS-451

Instructor : Syed Musharaf Ali

ROOM G-104-DSE IIUI


Ph# 051-9019724 Ext-2724
Regression Analysis
Regression analysis is a form of predictive modelling technique which
investigates the relationship between a
dependent (target) and independent variable (s) (predictor).

Independent variables are inputs and dependent variables are output

This technique is used for forecasting, time series modelling and


finding the cause effect relationship between the variables.

Examples: Oil price, temperature , Match outcome, Stock prices,


Currency values prediction, etc
Regression Analysis
Regression analysis is an important tool for modelling and analysing
data.

Here, we fit a curve / line to the data points, in such a manner that
the differences between the distances of data points from the curve
or line is minimized.
1. Linear Regression
• It is one of the most widely known modelling technique.

• Linear regression is usually among the first few topics which


people pick while learning predictive modelling.

• In this technique, the dependent variable is continuous,

• Linear Regression establishes a relationship between dependent


variable (Y) and one or more independent variables (X) using
a best fit straight line (also known as regression line).
1. Linear Regression
It is represented by an equation

Y=a + b*X + e
Similar to equation of line: y = mx+b

where a is intercept, b is slope of the line, X is input


variable( independent variable) and e is error term.

This equation can be used to predict the value of target variable


based on given predictor variable(s).
1. Linear Regression
1. Linear Regression
How to obtain best fit line (Value of a and b)?
This task can be easily accomplished by Least Square Method.
It is the most common method used for fitting a regression line.

For data points


y=mx+b, where m and b can be calculated by
1. Linear Regression
How to obtain best fit line (Value of a and b)?
1. Linear Regression
How to obtain best fit line (Value of a and b)?
1. Linear Regression
Important points

• There must be linear relationship between independent and dependent


variables

• Linear Regression is very sensitive to Outliers. It can terribly affect the


regression line and eventually the forecasted values.
1. Linear Regression
Example: Find the final score of the team in the T20 match where scores of 15
overs are given

(5,25), (10, 80), (15, 120), (20, ?)

By equations we found that

m = 9.5
b = -20

Substitute values for m and b for the given X in equation

y = mx+b
1. Linear Regression
Example: Find the final score of the team in the T20 match where scores of 15
overs are given

(5,25), (10, 80), (15, 120), (20, ?)

By equations we found that

m = 9.5
b = -20

For
x = 5 , y = 27.5
x = 10, y = 75
x = 15, y = 122.5
x = 20, y = 170
1. Linear Regression
Cost Function
It is a function that measures the performance of a Machine Learning model for
given data. Cost Function quantifies the error between predicted values and
expected values and presents it in the form of a single real number.
1. Linear Regression
Cost Function Example
https://medium.com/@lachlanmiller_52885/understanding-and-calculating-the-cost-fun
ction-for-linear-regression-39b8a3519fcb
1. Linear Regression
Cost Function Example

Cost function values


best_fit_1: 1.083
best_fit_2: 0.083
best_fit_3: 0.25
1. Linear Regression
Gradient Descent
Gradient descent is an optimization algorithm used to minimize some
function by iteratively moving in the direction of steepest descent as
defined by the negative of the gradient. In machine learning, gradient
descent to update the parameters of our model.
Gradient descent for one parameter
1. Linear Regression
Gradient Descent
Gradient descent for two parameter
1. Linear Regression
Gradient Descent
Gradient descent is an optimization algorithm used to find the values of
parameters (coefficients) of a function (f) that minimizes a cost function (cost).

Parameters update where α is learning rate


1. Linear Regression
Gradient Descent
Learning rate α update
1. Multivariate Linear Regression
Linear regression with multiple features
1. Multivariate Linear Regression
Linear regression with multiple features
1. Multivariate Linear Regression
Linear regression with multiple features
1. Multivariate Linear Regression
Linear regression with multiple features
1. Multivariate Linear Regression
Linear regression with multiple features
Gradient Descent
1. Multivariate Linear Regression
Linear regression with multiple features
Normal Equation: Method to solve parameters θ

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy