# difference between Gradient Descent and OLS,

Please I 'd like to ask when should I use gradient descent and when should I use OLS method and what is the difference between them ?

1 answers ( 0 marked as helpful)

**OLS** is preferred when a closed-form solution exists, and the dataset is not too large.

**Closed-form solution** - meaning that you can directly calculate the coefficients that minimize the sum of squared errors.

**Gradient Descent** is preferred when dealing with large datasets or high-dimensional data where the closed-form solution is computationally expensive.