SlideShare a Scribd company logo
4. MULTIVARIATE LINEAR
REGERESSION:
Hypothesis:
X = features vector or design vector
ΘT
= transpose of Θ
Θ = parameter vector
āž¢In linear regression with ONE VARIABLES: n=1
āž”thus n+1 = 2 āž” for Θ0 and Θ1
For multiple variables: n > 1
āž¢ Used when all input var. have different range of allowed
values. This makes optimizing slower. Its tedious to find the
local minima.
Example: if diff ranges are used the contours are quite steep type
āž¢ Īø will descend quickly on small ranges and slowly on large
ranges, and so will oscillate inefficiently down to the optimum
when the variables are very uneven.
To solve this: we can change scaling of x1 and x2
This will make the contours more balanced.
This is done to bring approximate values of all xi near a same range.
-1 and 1 are not necessary for all xi …we can work with nearly equal
ranges, like -3 to 3, etc… comparable ranges
āž¢We can speed up gradient descent by having each of our input
values in roughly the same range.
Ranges that would work:
Ranges that won’t work: if ranges are too larger or too smaller than
± 1
NOTE: x0 = 1 always. Its scaling is not changed.
āž¢There are two ways to change the ranges of x:
o Feature scaling
o Mean normalization
āž” Feature scaling involves dividing the input values by the
range (i.e. the maximum value minus the minimum value) of
the input variable, resulting in a new range of just 1.
For x1 : average size = 1000
Range = 2000 = upper limit – lower limit
For x2 : average size = 2
Range = 5
āž¢In mean normalization we try to bring xi in approx. range:
Note that dividing by the range, or dividing by the standard
deviation, give different results
PRICTICAL TIPS: for grad desc.
Making sure gradient descent is working correctly:
The goal is to minimize J
Plot J vs no of iterations, (not J vs Θ): J should decrease after every
iteration. In this curve, J(Θ) is the vertical height of that point.
After a time, the curve flattens – denoting the convergence has
occurred.
If J(θ) ever increases, then you probably need to decrease α.
All these are wrong curves for J(Θ) vs iterations. Solution: use
smaller values of α .
But not too small α as it slows the convergence. And not too large
either: as it may not converge.
DEFINING NEW FEATURES:
POLYNOMIAL REGRESSION: Non-linear hypothesis
āž” We can use different hypothesis equations for a single
dataset. Whichever best fits logically.
āž” For a multivariate: we can convert all features into
functions of each other:
Choice of features: We can convert our linear hypothesis into a
non-linear one
IMPORTANT: if you choose your features this way then feature
scaling becomes very important.
Thus, we find the best fitting curve for h(Θ).
Computing Parameters Analytically:
Up until now, we are using gradient descent Algorithm.. but now
we will use new Algo: NORMAL EQUATIONS
NORMAL EQUATIONS: method to solve for Θ analytically…
unlike grad desc, no need to iterate to minimize the J(Θ).. its
minimized directly in one go.
Intuition: for a single parameter Θ:
For multiple parameters:
Θ is a set of m Ī˜ā€™s.
For every Θi āž” we set partial derivative of J wrt to Θi == 0
o Then we find Θ corresponding to that eqn
o This is done for each Θ
m = number of example datas
n = no of features in input
n + 1 => we give an extra feature x0=1 to every example.
To construct the X matrix from xi vectors:
o Transpose them and fill into the X matrix, Such that the x’s
belonging to a single example.. comes in row
In above example : for all m training sets there are only 2 features
x0 and x1.
X’ = transpose of X
Feature scaling is not required in Normal Equations
method(algo)..Unlike in gradient desc => in which its req
WHEN TO USE GRAD DESC v/s NORMAL EQN:
When no. of features is small (upto 105) => use normal eqns.
As for large value of n=> X’ * X will be a n x n matrix: and we have
to find its inverse:
Inverse is of complexity O(n3
) => thus for large no. of input
features, grad desc is better way to converge to minima.
NON INVERTIBILITY PROBLEM IN NORMAL EQN METHOD:
Sometimes X’ * X is not inventible (singular/degenerate)..:
REASONS:
Redundant features – two columns or rows are proportional in the
X’ * X matrix. (i.e. they are linearly dependent)
SOLUTION: delete one of the dependent features.
Too many features – the number of features is too large as
compares to no of examples… (m << n)
SOLUTION: delete some features or Use REGULARIZATION
TECHNIQUE.
$OCTAVE: pinv(X’ * X) * X’ * y
 this would still give the right value of Θ. (Even if X’ * X is non
invertible).
pinv() is pseudo inverse
inv() is just inverse
Ad

More Related Content

What's hot (20)

13 unsupervised learning clustering
13 unsupervised learning   clustering13 unsupervised learning   clustering
13 unsupervised learning clustering
TanmayVijay1
Ā 
14 dimentionality reduction
14 dimentionality reduction14 dimentionality reduction
14 dimentionality reduction
TanmayVijay1
Ā 
17 large scale machine learning
17 large scale machine learning17 large scale machine learning
17 large scale machine learning
TanmayVijay1
Ā 
10 advice for applying ml
10 advice for applying ml10 advice for applying ml
10 advice for applying ml
TanmayVijay1
Ā 
Calc 2.1
Calc 2.1Calc 2.1
Calc 2.1
hartcher
Ā 
Lecture two
Lecture twoLecture two
Lecture two
Mahmoud Hussein
Ā 
31A WePrep Presentation
31A WePrep Presentation31A WePrep Presentation
31A WePrep Presentation
Ege Tanboga
Ā 
Teknik Simulasi
Teknik SimulasiTeknik Simulasi
Teknik Simulasi
Rezzy Caraka
Ā 
simplex method
simplex methodsimplex method
simplex method
Karishma Chaudhary
Ā 
Simplex Method Flowchart/Algorithm
Simplex Method Flowchart/AlgorithmSimplex Method Flowchart/Algorithm
Simplex Method Flowchart/Algorithm
Raja Adapa
Ā 
U6 Cn2 Definite Integrals Intro
U6 Cn2 Definite Integrals IntroU6 Cn2 Definite Integrals Intro
U6 Cn2 Definite Integrals Intro
Alexander Burt
Ā 
Ann a Algorithms notes
Ann a Algorithms notesAnn a Algorithms notes
Ann a Algorithms notes
Prof. Neeta Awasthy
Ā 
ML - Multiple Linear Regression
ML - Multiple Linear RegressionML - Multiple Linear Regression
ML - Multiple Linear Regression
Andrew Ferlitsch
Ā 
Random number generator
Random number generatorRandom number generator
Random number generator
Syed Atif Naseem
Ā 
Seismic data processing lecture 3
Seismic data processing lecture 3Seismic data processing lecture 3
Seismic data processing lecture 3
Amin khalil
Ā 
linear programming
linear programminglinear programming
linear programming
Jazz Bhatti
Ā 
Logistic regression in Machine Learning
Logistic regression in Machine LearningLogistic regression in Machine Learning
Logistic regression in Machine Learning
Kuppusamy P
Ā 
Seismic data processing
Seismic data processingSeismic data processing
Seismic data processing
Amin khalil
Ā 
Random number generation
Random number generationRandom number generation
Random number generation
Vinit Dantkale
Ā 
Seismic data processing introductory lecture
Seismic data processing introductory lectureSeismic data processing introductory lecture
Seismic data processing introductory lecture
Amin khalil
Ā 
13 unsupervised learning clustering
13 unsupervised learning   clustering13 unsupervised learning   clustering
13 unsupervised learning clustering
TanmayVijay1
Ā 
14 dimentionality reduction
14 dimentionality reduction14 dimentionality reduction
14 dimentionality reduction
TanmayVijay1
Ā 
17 large scale machine learning
17 large scale machine learning17 large scale machine learning
17 large scale machine learning
TanmayVijay1
Ā 
10 advice for applying ml
10 advice for applying ml10 advice for applying ml
10 advice for applying ml
TanmayVijay1
Ā 
Calc 2.1
Calc 2.1Calc 2.1
Calc 2.1
hartcher
Ā 
31A WePrep Presentation
31A WePrep Presentation31A WePrep Presentation
31A WePrep Presentation
Ege Tanboga
Ā 
Teknik Simulasi
Teknik SimulasiTeknik Simulasi
Teknik Simulasi
Rezzy Caraka
Ā 
Simplex Method Flowchart/Algorithm
Simplex Method Flowchart/AlgorithmSimplex Method Flowchart/Algorithm
Simplex Method Flowchart/Algorithm
Raja Adapa
Ā 
U6 Cn2 Definite Integrals Intro
U6 Cn2 Definite Integrals IntroU6 Cn2 Definite Integrals Intro
U6 Cn2 Definite Integrals Intro
Alexander Burt
Ā 
ML - Multiple Linear Regression
ML - Multiple Linear RegressionML - Multiple Linear Regression
ML - Multiple Linear Regression
Andrew Ferlitsch
Ā 
Random number generator
Random number generatorRandom number generator
Random number generator
Syed Atif Naseem
Ā 
Seismic data processing lecture 3
Seismic data processing lecture 3Seismic data processing lecture 3
Seismic data processing lecture 3
Amin khalil
Ā 
linear programming
linear programminglinear programming
linear programming
Jazz Bhatti
Ā 
Logistic regression in Machine Learning
Logistic regression in Machine LearningLogistic regression in Machine Learning
Logistic regression in Machine Learning
Kuppusamy P
Ā 
Seismic data processing
Seismic data processingSeismic data processing
Seismic data processing
Amin khalil
Ā 
Random number generation
Random number generationRandom number generation
Random number generation
Vinit Dantkale
Ā 
Seismic data processing introductory lecture
Seismic data processing introductory lectureSeismic data processing introductory lecture
Seismic data processing introductory lecture
Amin khalil
Ā 

Similar to 4 linear regeression with multiple variables (20)

2. Linear regression with one variable.pptx
2. Linear regression with one variable.pptx2. Linear regression with one variable.pptx
2. Linear regression with one variable.pptx
Emad Nabil
Ā 
Ai saturdays presentation
Ai saturdays presentationAi saturdays presentation
Ai saturdays presentation
Gurram Poorna Prudhvi
Ā 
2. diagnostics, collinearity, transformation, and missing data
2. diagnostics, collinearity, transformation, and missing data 2. diagnostics, collinearity, transformation, and missing data
2. diagnostics, collinearity, transformation, and missing data
Malik Hassan Qayyum šŸ•µšŸ»ā€ā™‚ļø
Ā 
Machine learning
Machine learningMachine learning
Machine learning
Shreyas G S
Ā 
Machine Learning 1
Machine Learning 1Machine Learning 1
Machine Learning 1
cairo university
Ā 
Calculus BC
Calculus BCCalculus BC
Calculus BC
Spandana Govindgari
Ā 
UE19EC353 ML Unit4_slides.pptx
UE19EC353 ML Unit4_slides.pptxUE19EC353 ML Unit4_slides.pptx
UE19EC353 ML Unit4_slides.pptx
premkumar901866
Ā 
lec22 pca- DIMENSILANITY REDUCTION.pptx
lec22  pca- DIMENSILANITY REDUCTION.pptxlec22  pca- DIMENSILANITY REDUCTION.pptx
lec22 pca- DIMENSILANITY REDUCTION.pptx
geethar79
Ā 
Regression_1.pdf
Regression_1.pdfRegression_1.pdf
Regression_1.pdf
Amir Saleh
Ā 
CALCULUS chapter number one presentation
CALCULUS chapter number one presentationCALCULUS chapter number one presentation
CALCULUS chapter number one presentation
kdoha825
Ā 
Power method
Power methodPower method
Power method
nashaat algrara
Ā 
FSE 200AdkinsPage 1 of 10Simple Linear Regression Corr.docx
FSE 200AdkinsPage 1 of 10Simple Linear Regression Corr.docxFSE 200AdkinsPage 1 of 10Simple Linear Regression Corr.docx
FSE 200AdkinsPage 1 of 10Simple Linear Regression Corr.docx
budbarber38650
Ā 
Illustrative Introductory Neural Networks
Illustrative Introductory Neural NetworksIllustrative Introductory Neural Networks
Illustrative Introductory Neural Networks
YasutoTamura1
Ā 
Bootcamp of new world to taken seriously
Bootcamp of new world to taken seriouslyBootcamp of new world to taken seriously
Bootcamp of new world to taken seriously
khaled125087
Ā 
Secent method
Secent methodSecent method
Secent method
ritu1806
Ā 
Advanced functions part ii
Advanced functions part iiAdvanced functions part ii
Advanced functions part ii
wendyvazzy
Ā 
Calc 3.5
Calc 3.5Calc 3.5
Calc 3.5
hartcher
Ā 
working with python
working with pythonworking with python
working with python
bhavesh lande
Ā 
Machine learning introduction lecture notes
Machine learning introduction lecture notesMachine learning introduction lecture notes
Machine learning introduction lecture notes
UmeshJagga1
Ā 
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic NetsData Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Derek Kane
Ā 
2. Linear regression with one variable.pptx
2. Linear regression with one variable.pptx2. Linear regression with one variable.pptx
2. Linear regression with one variable.pptx
Emad Nabil
Ā 
Machine learning
Machine learningMachine learning
Machine learning
Shreyas G S
Ā 
UE19EC353 ML Unit4_slides.pptx
UE19EC353 ML Unit4_slides.pptxUE19EC353 ML Unit4_slides.pptx
UE19EC353 ML Unit4_slides.pptx
premkumar901866
Ā 
lec22 pca- DIMENSILANITY REDUCTION.pptx
lec22  pca- DIMENSILANITY REDUCTION.pptxlec22  pca- DIMENSILANITY REDUCTION.pptx
lec22 pca- DIMENSILANITY REDUCTION.pptx
geethar79
Ā 
Regression_1.pdf
Regression_1.pdfRegression_1.pdf
Regression_1.pdf
Amir Saleh
Ā 
CALCULUS chapter number one presentation
CALCULUS chapter number one presentationCALCULUS chapter number one presentation
CALCULUS chapter number one presentation
kdoha825
Ā 
FSE 200AdkinsPage 1 of 10Simple Linear Regression Corr.docx
FSE 200AdkinsPage 1 of 10Simple Linear Regression Corr.docxFSE 200AdkinsPage 1 of 10Simple Linear Regression Corr.docx
FSE 200AdkinsPage 1 of 10Simple Linear Regression Corr.docx
budbarber38650
Ā 
Illustrative Introductory Neural Networks
Illustrative Introductory Neural NetworksIllustrative Introductory Neural Networks
Illustrative Introductory Neural Networks
YasutoTamura1
Ā 
Bootcamp of new world to taken seriously
Bootcamp of new world to taken seriouslyBootcamp of new world to taken seriously
Bootcamp of new world to taken seriously
khaled125087
Ā 
Secent method
Secent methodSecent method
Secent method
ritu1806
Ā 
Advanced functions part ii
Advanced functions part iiAdvanced functions part ii
Advanced functions part ii
wendyvazzy
Ā 
Calc 3.5
Calc 3.5Calc 3.5
Calc 3.5
hartcher
Ā 
working with python
working with pythonworking with python
working with python
bhavesh lande
Ā 
Machine learning introduction lecture notes
Machine learning introduction lecture notesMachine learning introduction lecture notes
Machine learning introduction lecture notes
UmeshJagga1
Ā 
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic NetsData Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Derek Kane
Ā 
Ad

Recently uploaded (20)

Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
Ā 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
Ā 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
Ā 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
Ā 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
Ā 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
Ā 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
Ā 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
Ā 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
Ā 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
Ā 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
Ā 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
Ā 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
Ā 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
Ā 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
Ā 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
Ā 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
Ā 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
Ā 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
Ā 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
Ā 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
Ā 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
Ā 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
Ā 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
Ā 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
Ā 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
Ā 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
Ā 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
Ā 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
Ā 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
Ā 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
Ā 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
Ā 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
Ā 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
Ā 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
Ā 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
Ā 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
Ā 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
Ā 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
Ā 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
Ā 
Ad

4 linear regeression with multiple variables

  • 2. X = features vector or design vector ΘT = transpose of Θ Θ = parameter vector āž¢In linear regression with ONE VARIABLES: n=1 āž”thus n+1 = 2 āž” for Θ0 and Θ1
  • 3. For multiple variables: n > 1 āž¢ Used when all input var. have different range of allowed values. This makes optimizing slower. Its tedious to find the local minima.
  • 4. Example: if diff ranges are used the contours are quite steep type āž¢ Īø will descend quickly on small ranges and slowly on large ranges, and so will oscillate inefficiently down to the optimum when the variables are very uneven. To solve this: we can change scaling of x1 and x2 This will make the contours more balanced. This is done to bring approximate values of all xi near a same range. -1 and 1 are not necessary for all xi …we can work with nearly equal ranges, like -3 to 3, etc… comparable ranges
  • 5. āž¢We can speed up gradient descent by having each of our input values in roughly the same range. Ranges that would work: Ranges that won’t work: if ranges are too larger or too smaller than ± 1 NOTE: x0 = 1 always. Its scaling is not changed. āž¢There are two ways to change the ranges of x: o Feature scaling o Mean normalization
  • 6. āž” Feature scaling involves dividing the input values by the range (i.e. the maximum value minus the minimum value) of the input variable, resulting in a new range of just 1. For x1 : average size = 1000 Range = 2000 = upper limit – lower limit For x2 : average size = 2 Range = 5 āž¢In mean normalization we try to bring xi in approx. range:
  • 7. Note that dividing by the range, or dividing by the standard deviation, give different results PRICTICAL TIPS: for grad desc.
  • 8. Making sure gradient descent is working correctly: The goal is to minimize J Plot J vs no of iterations, (not J vs Θ): J should decrease after every iteration. In this curve, J(Θ) is the vertical height of that point. After a time, the curve flattens – denoting the convergence has occurred.
  • 9. If J(Īø) ever increases, then you probably need to decrease α. All these are wrong curves for J(Θ) vs iterations. Solution: use smaller values of α . But not too small α as it slows the convergence. And not too large either: as it may not converge.
  • 10. DEFINING NEW FEATURES: POLYNOMIAL REGRESSION: Non-linear hypothesis āž” We can use different hypothesis equations for a single dataset. Whichever best fits logically. āž” For a multivariate: we can convert all features into functions of each other:
  • 11. Choice of features: We can convert our linear hypothesis into a non-linear one IMPORTANT: if you choose your features this way then feature scaling becomes very important. Thus, we find the best fitting curve for h(Θ).
  • 12. Computing Parameters Analytically: Up until now, we are using gradient descent Algorithm.. but now we will use new Algo: NORMAL EQUATIONS NORMAL EQUATIONS: method to solve for Θ analytically… unlike grad desc, no need to iterate to minimize the J(Θ).. its minimized directly in one go. Intuition: for a single parameter Θ: For multiple parameters: Θ is a set of m Ī˜ā€™s. For every Θi āž” we set partial derivative of J wrt to Θi == 0 o Then we find Θ corresponding to that eqn o This is done for each Θ
  • 13. m = number of example datas n = no of features in input n + 1 => we give an extra feature x0=1 to every example. To construct the X matrix from xi vectors: o Transpose them and fill into the X matrix, Such that the x’s belonging to a single example.. comes in row
  • 14. In above example : for all m training sets there are only 2 features x0 and x1. X’ = transpose of X Feature scaling is not required in Normal Equations method(algo)..Unlike in gradient desc => in which its req WHEN TO USE GRAD DESC v/s NORMAL EQN:
  • 15. When no. of features is small (upto 105) => use normal eqns. As for large value of n=> X’ * X will be a n x n matrix: and we have to find its inverse: Inverse is of complexity O(n3 ) => thus for large no. of input features, grad desc is better way to converge to minima. NON INVERTIBILITY PROBLEM IN NORMAL EQN METHOD: Sometimes X’ * X is not inventible (singular/degenerate)..: REASONS: Redundant features – two columns or rows are proportional in the X’ * X matrix. (i.e. they are linearly dependent) SOLUTION: delete one of the dependent features. Too many features – the number of features is too large as compares to no of examples… (m << n) SOLUTION: delete some features or Use REGULARIZATION TECHNIQUE. $OCTAVE: pinv(X’ * X) * X’ * y  this would still give the right value of Θ. (Even if X’ * X is non invertible). pinv() is pseudo inverse inv() is just inverse