Intermediate
Open
Pro
Normal Equation vs Gradient Descent
You need to fit a linear regression in three settings:
- (a) 20,000 rows, 30 features, one-off analysis in a notebook.
- (b) 50 million rows, 2,000 dense features, retrained nightly on a single machine with 32 GB RAM.
- (c) 5 million rows, 3 million sparse one-hot features (n-grams), trained once.
- For each setting, choose closed-form OLS or (stochastic) gradient descent and justify with rough cost reasoning.
- Your colleague runs gradient descent on setting (a) with raw features (income in dollars, age in years) and reports it "barely moves after 10,000 iterations." Diagnose and fix.
- Does feature scaling change the closed-form solution's predictions? Its coefficients?
Share this question