### Computaional cost for grid search

I am having trouble computing the computational cost for grid search. Can someone please help with that?
Also, can you please mention how to calculate the number of steps for gd and sgd?

Thanks a lot!

Hi, I am not 100% sure but I would compute it as following:

If you want to test $$M$$ possible values for each dimension of $$\mathbf{w}$$ in $$R^D$$, then:

• you have to check for $$M^D$$ points
• for each point, you have to compute the loss function (say $$\mathcal{O}(N\cdot D)$$ for MSE).

Therefore, the full complexity of the grid search would be, according to me:

$$\mathcal{O}(M^D\cdot N \cdot D)$$

Page 1 of 1