TransWikia.com

Gradient Descent or Normal Equation?

Data Science Asked by Rahman Turtle on February 19, 2021

Suppose you have a dataset with m = 50 examples and n = 15 features for each example. You want to use multivariate linear regression to fit the parameters theta to our data. Should you prefer gradient descent or the normal equation and why?

2 Answers

If you can, it is preferable to use the normal equation to estimate the coefficients for multivariate linear regression. Since the normal equation is a closed-form expression, it will be faster than gradient descent.

Given you have relatively few examples and features, inverting the matrix is not an issue.

Answered by Brian Spiering on February 19, 2021

You need to think in terms of sample size.
You don't have enough examples to use Gradient Descent. I believe you need at least several 100s.
Conversely, doing inverse and transpose on small matrices like this with Normal Equation should be pretty fast.

Answered by θ Grunberg on February 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP