gradient descent - getting the basics right

17 Views Asked by At

So, I found this question:

Given that $w_{j+1}=w_{j}-v∇Q(w_{j})$

Let $Q(w_{1},w_{2})=\frac{1}{2}(w^2_{1}+w^2_{2}).$

Suppose $w_{0}=(1,0)$ and $v=2$,

what is $w_{2}$?

The answer given is (1,0) with the explanation below:

Note that ∇Q(1,0)=(1,0). So $w_{1}=w_{0}-2 \cdot (1,0)=(-1,0).$

Now ∇Q(-1,0)=(-1,0). So $w_{2}=w_{1}-2 \cdot (-1,0)=(1,0).$

Beginner here, I don't really understand the parts where

  • ∇Q(1,0)=(1,0)

  • ∇Q(−1,0)=(−1,0)

any explanation or help would be much appreciated

1

There are 1 best solutions below

0
On BEST ANSWER

The gradient of a sufficiently differentiable (don’t quote me on this) function $f:\mathbb R^n \rightarrow \mathbb R$ is given by the vector valued function $$\nabla f:\mathbb R^n \rightarrow \mathbb R^n,(x_1,...,x_n)\mapsto(\dfrac{\partial f}{\partial x_1}(x_1,...,x_n),...,\dfrac{\partial f}{\partial x_n}(x_1,...,x_n))$$ (Actually it should be the transpose of this vector, but as you have written every vector as row-vector, I will continue to do so for the sake of consistency).

In your case we have $Q:\mathbb R^2 \rightarrow \mathbb R, (x,y) \mapsto \frac{1}{2}(x^2+y^2)$. The gradient is thus given by $$\nabla Q(x,y) = (\dfrac{\partial Q}{\partial x}(x,y),\dfrac{\partial Q}{\partial y}(x,y)) = (x,y)$$ since $\dfrac{\partial Q}{\partial x} = \dfrac{\partial}{\partial x} \frac{1}{2}x^2 + \dfrac{\partial}{\partial x} \frac{1}{2} y^2 = x$.