SlideShare a Scribd company logo
1 of 3
Download to read offline
Normal equations for linear regression?
No! Please no!
Hamed Zakerzadeh
Hamed Zakerzadeh Normal equations 1 / 3
Linear regression
Find the best parameters β describing the linear relation
between n variables x1, ⋯, xn (columns of X ∈ Rm×n
) and y,
having m data points, that is, to minimize ε:
y = Xβ + ε
How to solve minβ ∥Xβ − y∥?
using normal equation
Apply first-order optimality condition:
(Xt
X) β = Xt
y
solve n × n full symmetric system
using Cholesky factorization
using QR decomposition
X = Q R the product of orthogonal Q ∈ Rm×m
and upper-triangular R ∈ Rm×n
min
β
∥Xβ − y∥ = min
β
∥R β − Qt
y∥
solve simple n × n upper-triangular
system using backward substitution
If m ≫ n Ô⇒ NE method is 2x faster (flops: O(n3
+ mn2
) vs O(2mn2
) for QR)
Hamed Zakerzadeh Normal equations 2 / 3
Achilles heel: numerical stability
Information may be lost forming Xt
X: [
1 1
 0
] Ô⇒ [
1 + 2
1
1 1
]
Condition number being denoted by κ, forward error bound is proportional to
κ(X)2
for NE method while it was only κ(X) for the original least squares problem.
QR method is always backward stable while NE method is guaranteed to be
backward stable only if X is well-conditioned.
The last word
NE method is simple for teaching machine learning and, sometimes, useful in practice.
But be aware of its disadvantages!
“Although numerical analysts almost invariably
solve the full rank LS problem by QR factor-
ization, statisticians frequently use the normal
equations (though perhaps less frequently than
they used to, thanks to the influence of numer-
ical analysts).”
Hamed Zakerzadeh Normal equations 3 / 3

More Related Content

What's hot

Proofs nearest rank
Proofs nearest rankProofs nearest rank
Proofs nearest rankfithisux
 
Friedrichs1958
Friedrichs1958Friedrichs1958
Friedrichs1958staros11
 
Theorem-proving Verification of Multi-clock Synchronous Circuits on Multimoda...
Theorem-proving Verification of Multi-clock Synchronous Circuits on Multimoda...Theorem-proving Verification of Multi-clock Synchronous Circuits on Multimoda...
Theorem-proving Verification of Multi-clock Synchronous Circuits on Multimoda...Shunji Nishimura
 
Basic terminology description in convex optimization
Basic terminology description in convex optimizationBasic terminology description in convex optimization
Basic terminology description in convex optimizationVARUN KUMAR
 
Composition Of Functions & Difference Quotient
Composition Of Functions & Difference QuotientComposition Of Functions & Difference Quotient
Composition Of Functions & Difference Quotientcpirie0607
 
Fixedpoint
FixedpointFixedpoint
Fixedpointuis
 
Zero. Probabilystic Foundation of Theoretyical Physics
Zero. Probabilystic Foundation of Theoretyical PhysicsZero. Probabilystic Foundation of Theoretyical Physics
Zero. Probabilystic Foundation of Theoretyical PhysicsGunn Quznetsov
 
Newton Raphson Method
Newton Raphson MethodNewton Raphson Method
Newton Raphson MethodTayyaba Abbas
 
Help, we have no more time for testing! (gotoCon Berlin 2013)
Help, we have no more time for testing! (gotoCon Berlin 2013)Help, we have no more time for testing! (gotoCon Berlin 2013)
Help, we have no more time for testing! (gotoCon Berlin 2013)Dr. Alexander Schwartz
 
L4 one sided limits limits at infinity
L4 one sided limits limits at infinityL4 one sided limits limits at infinity
L4 one sided limits limits at infinityJames Tagara
 
Application of integral calculus
Application of integral calculusApplication of integral calculus
Application of integral calculusHabibur Rahman
 
Change of order in integration
Change of order in integrationChange of order in integration
Change of order in integrationShubham Sojitra
 

What's hot (16)

Proofs nearest rank
Proofs nearest rankProofs nearest rank
Proofs nearest rank
 
Friedrichs1958
Friedrichs1958Friedrichs1958
Friedrichs1958
 
Theorem-proving Verification of Multi-clock Synchronous Circuits on Multimoda...
Theorem-proving Verification of Multi-clock Synchronous Circuits on Multimoda...Theorem-proving Verification of Multi-clock Synchronous Circuits on Multimoda...
Theorem-proving Verification of Multi-clock Synchronous Circuits on Multimoda...
 
Basic terminology description in convex optimization
Basic terminology description in convex optimizationBasic terminology description in convex optimization
Basic terminology description in convex optimization
 
Composition Of Functions & Difference Quotient
Composition Of Functions & Difference QuotientComposition Of Functions & Difference Quotient
Composition Of Functions & Difference Quotient
 
Fixedpoint
FixedpointFixedpoint
Fixedpoint
 
Cycloidal pendulum
Cycloidal pendulumCycloidal pendulum
Cycloidal pendulum
 
Zero. Probabilystic Foundation of Theoretyical Physics
Zero. Probabilystic Foundation of Theoretyical PhysicsZero. Probabilystic Foundation of Theoretyical Physics
Zero. Probabilystic Foundation of Theoretyical Physics
 
Tensor analysis
Tensor analysisTensor analysis
Tensor analysis
 
Newton Raphson Method
Newton Raphson MethodNewton Raphson Method
Newton Raphson Method
 
Help, we have no more time for testing! (gotoCon Berlin 2013)
Help, we have no more time for testing! (gotoCon Berlin 2013)Help, we have no more time for testing! (gotoCon Berlin 2013)
Help, we have no more time for testing! (gotoCon Berlin 2013)
 
L4 one sided limits limits at infinity
L4 one sided limits limits at infinityL4 one sided limits limits at infinity
L4 one sided limits limits at infinity
 
Line integrals
Line integralsLine integrals
Line integrals
 
Application of integral calculus
Application of integral calculusApplication of integral calculus
Application of integral calculus
 
Application of Derivative 1
Application of Derivative 1Application of Derivative 1
Application of Derivative 1
 
Change of order in integration
Change of order in integrationChange of order in integration
Change of order in integration
 

Similar to Normal equations for linear regression?

Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Fabian Pedregosa
 
Solving High-order Non-linear Partial Differential Equations by Modified q-Ho...
Solving High-order Non-linear Partial Differential Equations by Modified q-Ho...Solving High-order Non-linear Partial Differential Equations by Modified q-Ho...
Solving High-order Non-linear Partial Differential Equations by Modified q-Ho...BRNSS Publication Hub
 
MASSS_Presentation_20160209
MASSS_Presentation_20160209MASSS_Presentation_20160209
MASSS_Presentation_20160209Yimin Wu
 
Non-negative Matrix Factorization
Non-negative Matrix FactorizationNon-negative Matrix Factorization
Non-negative Matrix FactorizationAkankshaAgrawal55
 
Recurrence equations
Recurrence equationsRecurrence equations
Recurrence equationsTarun Gehlot
 
The low-rank basis problem for a matrix subspace
The low-rank basis problem for a matrix subspaceThe low-rank basis problem for a matrix subspace
The low-rank basis problem for a matrix subspaceTasuku Soma
 
Appendex b
Appendex bAppendex b
Appendex bswavicky
 
Concentration inequality in Machine Learning
Concentration inequality in Machine LearningConcentration inequality in Machine Learning
Concentration inequality in Machine LearningVARUN KUMAR
 
Chapter 3 solving systems of linear equations
Chapter 3 solving systems of linear equationsChapter 3 solving systems of linear equations
Chapter 3 solving systems of linear equationsssuser53ee01
 
The electromagnetic field
The electromagnetic fieldThe electromagnetic field
The electromagnetic fieldGabriel O'Brien
 

Similar to Normal equations for linear regression? (20)

Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3
 
06_AJMS_256_20-compressed.pdf
06_AJMS_256_20-compressed.pdf06_AJMS_256_20-compressed.pdf
06_AJMS_256_20-compressed.pdf
 
Solving High-order Non-linear Partial Differential Equations by Modified q-Ho...
Solving High-order Non-linear Partial Differential Equations by Modified q-Ho...Solving High-order Non-linear Partial Differential Equations by Modified q-Ho...
Solving High-order Non-linear Partial Differential Equations by Modified q-Ho...
 
Ch07 5
Ch07 5Ch07 5
Ch07 5
 
Metodo gauss_newton.pdf
Metodo gauss_newton.pdfMetodo gauss_newton.pdf
Metodo gauss_newton.pdf
 
QMC: Operator Splitting Workshop, Using Sequences of Iterates in Inertial Met...
QMC: Operator Splitting Workshop, Using Sequences of Iterates in Inertial Met...QMC: Operator Splitting Workshop, Using Sequences of Iterates in Inertial Met...
QMC: Operator Splitting Workshop, Using Sequences of Iterates in Inertial Met...
 
MASSS_Presentation_20160209
MASSS_Presentation_20160209MASSS_Presentation_20160209
MASSS_Presentation_20160209
 
Non-negative Matrix Factorization
Non-negative Matrix FactorizationNon-negative Matrix Factorization
Non-negative Matrix Factorization
 
Recurrence equations
Recurrence equationsRecurrence equations
Recurrence equations
 
Es272 ch5a
Es272 ch5aEs272 ch5a
Es272 ch5a
 
The low-rank basis problem for a matrix subspace
The low-rank basis problem for a matrix subspaceThe low-rank basis problem for a matrix subspace
The low-rank basis problem for a matrix subspace
 
Quadrature
QuadratureQuadrature
Quadrature
 
Lecture 3 - Linear Regression
Lecture 3 - Linear RegressionLecture 3 - Linear Regression
Lecture 3 - Linear Regression
 
Appendex b
Appendex bAppendex b
Appendex b
 
Concentration inequality in Machine Learning
Concentration inequality in Machine LearningConcentration inequality in Machine Learning
Concentration inequality in Machine Learning
 
2018 MUMS Fall Course - Statistical Representation of Model Input (EDITED) - ...
2018 MUMS Fall Course - Statistical Representation of Model Input (EDITED) - ...2018 MUMS Fall Course - Statistical Representation of Model Input (EDITED) - ...
2018 MUMS Fall Course - Statistical Representation of Model Input (EDITED) - ...
 
Chapter 3 solving systems of linear equations
Chapter 3 solving systems of linear equationsChapter 3 solving systems of linear equations
Chapter 3 solving systems of linear equations
 
The electromagnetic field
The electromagnetic fieldThe electromagnetic field
The electromagnetic field
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
overviewPCA
overviewPCAoverviewPCA
overviewPCA
 

More from Hamed Zakerzadeh

Can you count on your computer?
Can you count on your computer?Can you count on your computer?
Can you count on your computer?Hamed Zakerzadeh
 
Asymptotic Preserving Schemes
Asymptotic Preserving SchemesAsymptotic Preserving Schemes
Asymptotic Preserving SchemesHamed Zakerzadeh
 
Is “Principal Component Analysis” different from SVD?
Is “Principal Component Analysis” different from SVD?Is “Principal Component Analysis” different from SVD?
Is “Principal Component Analysis” different from SVD?Hamed Zakerzadeh
 
Can you count on your computer for the Gaussian elimination?
Can you count on your computer for the Gaussian elimination?Can you count on your computer for the Gaussian elimination?
Can you count on your computer for the Gaussian elimination?Hamed Zakerzadeh
 
ENTROPY STABLE ENO SCHEMES
ENTROPY STABLE ENO SCHEMESENTROPY STABLE ENO SCHEMES
ENTROPY STABLE ENO SCHEMESHamed Zakerzadeh
 

More from Hamed Zakerzadeh (7)

Can you count on your computer?
Can you count on your computer?Can you count on your computer?
Can you count on your computer?
 
Asymptotic Preserving Schemes
Asymptotic Preserving SchemesAsymptotic Preserving Schemes
Asymptotic Preserving Schemes
 
Is “Principal Component Analysis” different from SVD?
Is “Principal Component Analysis” different from SVD?Is “Principal Component Analysis” different from SVD?
Is “Principal Component Analysis” different from SVD?
 
Can you count on your computer for the Gaussian elimination?
Can you count on your computer for the Gaussian elimination?Can you count on your computer for the Gaussian elimination?
Can you count on your computer for the Gaussian elimination?
 
Congrès SMAI 2019
Congrès SMAI 2019Congrès SMAI 2019
Congrès SMAI 2019
 
Higham
HighamHigham
Higham
 
ENTROPY STABLE ENO SCHEMES
ENTROPY STABLE ENO SCHEMESENTROPY STABLE ENO SCHEMES
ENTROPY STABLE ENO SCHEMES
 

Recently uploaded

Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksSérgio Sacani
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )aarthirajkumar25
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencySheetal Arora
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxAArockiyaNisha
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxgindu3009
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticssakshisoni2385
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRDelhi Call girls
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsAArockiyaNisha
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsSérgio Sacani
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...Sérgio Sacani
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.Nitya salvi
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfSumit Kumar yadav
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisDiwakar Mishra
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bSérgio Sacani
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)PraveenaKalaiselvan1
 
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPirithiRaju
 
Zoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfZoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfSumit Kumar yadav
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptxanandsmhk
 

Recently uploaded (20)

Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disks
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptx
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based Nanomaterials
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdf
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)
 
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
 
Zoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfZoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdf
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
 
CELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdfCELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdf
 

Normal equations for linear regression?

  • 1. Normal equations for linear regression? No! Please no! Hamed Zakerzadeh Hamed Zakerzadeh Normal equations 1 / 3
  • 2. Linear regression Find the best parameters β describing the linear relation between n variables x1, ⋯, xn (columns of X ∈ Rm×n ) and y, having m data points, that is, to minimize ε: y = Xβ + ε How to solve minβ ∥Xβ − y∥? using normal equation Apply first-order optimality condition: (Xt X) β = Xt y solve n × n full symmetric system using Cholesky factorization using QR decomposition X = Q R the product of orthogonal Q ∈ Rm×m and upper-triangular R ∈ Rm×n min β ∥Xβ − y∥ = min β ∥R β − Qt y∥ solve simple n × n upper-triangular system using backward substitution If m ≫ n Ô⇒ NE method is 2x faster (flops: O(n3 + mn2 ) vs O(2mn2 ) for QR) Hamed Zakerzadeh Normal equations 2 / 3
  • 3. Achilles heel: numerical stability Information may be lost forming Xt X: [ 1 1 0 ] Ô⇒ [ 1 + 2 1 1 1 ] Condition number being denoted by κ, forward error bound is proportional to κ(X)2 for NE method while it was only κ(X) for the original least squares problem. QR method is always backward stable while NE method is guaranteed to be backward stable only if X is well-conditioned. The last word NE method is simple for teaching machine learning and, sometimes, useful in practice. But be aware of its disadvantages! “Although numerical analysts almost invariably solve the full rank LS problem by QR factor- ization, statisticians frequently use the normal equations (though perhaps less frequently than they used to, thanks to the influence of numer- ical analysts).” Hamed Zakerzadeh Normal equations 3 / 3