Optimizing Plane Fitting Using Stochastic Gradient Descent

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 2K views
zzmanzz
Messages
47
Reaction score
0

Homework Statement



Suppose I wish to fit a plane
[tex]z = w_1 + w_2x +w_3y[/tex]
to a data set [tex](x_1,y_1,z_1), ... ,(x_n,y_n,z_n)[/tex]

Using gradient descent

Homework Equations



http://en.wikipedia.org/wiki/Stochastic_gradient_descent

The Attempt at a Solution



I'm basically trying to figure out the 3-dimensional version of the example on wiki.
The objective function to e minimized is:

[tex]Q(w) = \sum_{i = 1}^n Q_i(w) = \sum_{i = 1}^n (w_1 + w_2x_i + w_3y_i - z_i)^2[/tex]
I want to find the parameters of [tex]w_1,w_2,w_3[/tex]

The iterative method updates the parameters [tex]w^{(0)}_1,w^{(0)}_2,w^{(0)}_3[/tex]
1-step in the iteration
[tex] \left( \begin{array}{ccc}<br /> w^{(1)}_1 \\<br /> w^{(1)}_2\\<br /> w^{(1)}_3 \end{array} \right) = \left( \begin{array}{ccc}<br /> w^{(0)}_1 \\<br /> w^{(0)}_2 \\<br /> w^{(0)}_3 \end{array} \right) + \alpha \times \left( \begin{array}{ccc}<br /> 2(w^{(0)}_1 + w^{(0)}_2x_i + w^{(0)}_3 y_i - z_i) \\<br /> 2x_i(w^{(0)}_1 + w^{(0)}_2x_i + w^{(0)}_3 y_i - z_i) \\<br /> 2y_i(w^{(0)}_1+ w^{(0)}_2x_i + w^{(0)}_3 y_i - z_i) \end{array} \right)[/tex]

[tex]\alpha [\tex] is the step size.[/tex]
 
Last edited:
Physics news on Phys.org
Looks good. Whats your question?
 
Just wanted to make sure that I didn't cheat or something in my solution. When I run it in c++ it works very well.