How to differentiate $sum_i(y_i-t_i)^2$ by $y$?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
$L=sum_i(y_i-t_i)^2$
I want to differentiate $L$ by $y$.
Unfortunately I didn't learn this material, so a wild guess would be:
$(1) fracdLdy=fracddy (vecycdot vecy^T -2cdot vecy cdot vect^T + vect cdot vect)$
From here I got to:
$=2vecy-2vect^T$
But I guess this not ok, because the dimensions are not equal. This means I needed to do:
$(2) fracdLdy=fracddy vecycdot vecy^T -2cdot vect cdot vecy^T + vect cdot vect$
And then I'll get $=2vecy-2vect$ which is the correct answer I think.
I switched places because it suited me better, but I don't think that math works that way. I'm sure there is an algorithm for these operations.
How I was supposed to know that I should of opened it like in $(2)$ and not like $(1)$ ?
calculus linear-algebra derivatives vectors
add a comment |Â
up vote
0
down vote
favorite
$L=sum_i(y_i-t_i)^2$
I want to differentiate $L$ by $y$.
Unfortunately I didn't learn this material, so a wild guess would be:
$(1) fracdLdy=fracddy (vecycdot vecy^T -2cdot vecy cdot vect^T + vect cdot vect)$
From here I got to:
$=2vecy-2vect^T$
But I guess this not ok, because the dimensions are not equal. This means I needed to do:
$(2) fracdLdy=fracddy vecycdot vecy^T -2cdot vect cdot vecy^T + vect cdot vect$
And then I'll get $=2vecy-2vect$ which is the correct answer I think.
I switched places because it suited me better, but I don't think that math works that way. I'm sure there is an algorithm for these operations.
How I was supposed to know that I should of opened it like in $(2)$ and not like $(1)$ ?
calculus linear-algebra derivatives vectors
$y=(y_1,y_2,ldots,y_n)$?
â MathOverview
Sep 9 at 13:38
@MathOverview Yes sorry
â sheldonzy
Sep 9 at 13:39
Question. In equality "(1)" would not $ vectcdot vect^T $ be in place of $ vectcdotvect$?
â MathOverview
Sep 9 at 13:41
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
$L=sum_i(y_i-t_i)^2$
I want to differentiate $L$ by $y$.
Unfortunately I didn't learn this material, so a wild guess would be:
$(1) fracdLdy=fracddy (vecycdot vecy^T -2cdot vecy cdot vect^T + vect cdot vect)$
From here I got to:
$=2vecy-2vect^T$
But I guess this not ok, because the dimensions are not equal. This means I needed to do:
$(2) fracdLdy=fracddy vecycdot vecy^T -2cdot vect cdot vecy^T + vect cdot vect$
And then I'll get $=2vecy-2vect$ which is the correct answer I think.
I switched places because it suited me better, but I don't think that math works that way. I'm sure there is an algorithm for these operations.
How I was supposed to know that I should of opened it like in $(2)$ and not like $(1)$ ?
calculus linear-algebra derivatives vectors
$L=sum_i(y_i-t_i)^2$
I want to differentiate $L$ by $y$.
Unfortunately I didn't learn this material, so a wild guess would be:
$(1) fracdLdy=fracddy (vecycdot vecy^T -2cdot vecy cdot vect^T + vect cdot vect)$
From here I got to:
$=2vecy-2vect^T$
But I guess this not ok, because the dimensions are not equal. This means I needed to do:
$(2) fracdLdy=fracddy vecycdot vecy^T -2cdot vect cdot vecy^T + vect cdot vect$
And then I'll get $=2vecy-2vect$ which is the correct answer I think.
I switched places because it suited me better, but I don't think that math works that way. I'm sure there is an algorithm for these operations.
How I was supposed to know that I should of opened it like in $(2)$ and not like $(1)$ ?
calculus linear-algebra derivatives vectors
calculus linear-algebra derivatives vectors
edited Sep 9 at 13:43
MathOverview
8,41842962
8,41842962
asked Sep 9 at 13:33
sheldonzy
378414
378414
$y=(y_1,y_2,ldots,y_n)$?
â MathOverview
Sep 9 at 13:38
@MathOverview Yes sorry
â sheldonzy
Sep 9 at 13:39
Question. In equality "(1)" would not $ vectcdot vect^T $ be in place of $ vectcdotvect$?
â MathOverview
Sep 9 at 13:41
add a comment |Â
$y=(y_1,y_2,ldots,y_n)$?
â MathOverview
Sep 9 at 13:38
@MathOverview Yes sorry
â sheldonzy
Sep 9 at 13:39
Question. In equality "(1)" would not $ vectcdot vect^T $ be in place of $ vectcdotvect$?
â MathOverview
Sep 9 at 13:41
$y=(y_1,y_2,ldots,y_n)$?
â MathOverview
Sep 9 at 13:38
$y=(y_1,y_2,ldots,y_n)$?
â MathOverview
Sep 9 at 13:38
@MathOverview Yes sorry
â sheldonzy
Sep 9 at 13:39
@MathOverview Yes sorry
â sheldonzy
Sep 9 at 13:39
Question. In equality "(1)" would not $ vectcdot vect^T $ be in place of $ vectcdotvect$?
â MathOverview
Sep 9 at 13:41
Question. In equality "(1)" would not $ vectcdot vect^T $ be in place of $ vectcdotvect$?
â MathOverview
Sep 9 at 13:41
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
beginalignfracpartial Lpartial y_j&=fracpartial partial y_j sum_i (y_i-t_i)^2\&= fracpartial partial y_j left[(y_j-t_j)^2 + sum_i ne j (y_i-t_i)^2right]\&= fracpartial partial y_j left[(y_j-t_j)^2right] + left[fracpartialpartial y_j sum_i ne j (y_i-t_i)^2right]
\&=2(y_j-t_j) fracpartial (y_j-t_j)partial y_j +0\&=2(y_j-t_j) endalign
Hence $$nabla_y L=2(y-t)$$
Note that $y^Tt=t^Ty$, here all my vectors are column vectors.
Care to explain why it is equal to $2(y_j-t_j) fracpartial (y_j-t_j)partial y_j $ ? I guess by chain rule? Can you please write down the full calculation?
â sheldonzy
Sep 9 at 13:46
I have added more details.
â Siong Thye Goh
Sep 9 at 13:50
Thanks! Just checking: it is $fracpartial (y_j-t_j)partial y_j $ because you are actually doing $fracLpartial (y_j-t_j) cdot fracpartial (y_j-t_j)partial y_j $ Right?
â sheldonzy
Sep 9 at 13:57
yup, that is just chain rule.
â Siong Thye Goh
Sep 9 at 14:01
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
beginalignfracpartial Lpartial y_j&=fracpartial partial y_j sum_i (y_i-t_i)^2\&= fracpartial partial y_j left[(y_j-t_j)^2 + sum_i ne j (y_i-t_i)^2right]\&= fracpartial partial y_j left[(y_j-t_j)^2right] + left[fracpartialpartial y_j sum_i ne j (y_i-t_i)^2right]
\&=2(y_j-t_j) fracpartial (y_j-t_j)partial y_j +0\&=2(y_j-t_j) endalign
Hence $$nabla_y L=2(y-t)$$
Note that $y^Tt=t^Ty$, here all my vectors are column vectors.
Care to explain why it is equal to $2(y_j-t_j) fracpartial (y_j-t_j)partial y_j $ ? I guess by chain rule? Can you please write down the full calculation?
â sheldonzy
Sep 9 at 13:46
I have added more details.
â Siong Thye Goh
Sep 9 at 13:50
Thanks! Just checking: it is $fracpartial (y_j-t_j)partial y_j $ because you are actually doing $fracLpartial (y_j-t_j) cdot fracpartial (y_j-t_j)partial y_j $ Right?
â sheldonzy
Sep 9 at 13:57
yup, that is just chain rule.
â Siong Thye Goh
Sep 9 at 14:01
add a comment |Â
up vote
1
down vote
accepted
beginalignfracpartial Lpartial y_j&=fracpartial partial y_j sum_i (y_i-t_i)^2\&= fracpartial partial y_j left[(y_j-t_j)^2 + sum_i ne j (y_i-t_i)^2right]\&= fracpartial partial y_j left[(y_j-t_j)^2right] + left[fracpartialpartial y_j sum_i ne j (y_i-t_i)^2right]
\&=2(y_j-t_j) fracpartial (y_j-t_j)partial y_j +0\&=2(y_j-t_j) endalign
Hence $$nabla_y L=2(y-t)$$
Note that $y^Tt=t^Ty$, here all my vectors are column vectors.
Care to explain why it is equal to $2(y_j-t_j) fracpartial (y_j-t_j)partial y_j $ ? I guess by chain rule? Can you please write down the full calculation?
â sheldonzy
Sep 9 at 13:46
I have added more details.
â Siong Thye Goh
Sep 9 at 13:50
Thanks! Just checking: it is $fracpartial (y_j-t_j)partial y_j $ because you are actually doing $fracLpartial (y_j-t_j) cdot fracpartial (y_j-t_j)partial y_j $ Right?
â sheldonzy
Sep 9 at 13:57
yup, that is just chain rule.
â Siong Thye Goh
Sep 9 at 14:01
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
beginalignfracpartial Lpartial y_j&=fracpartial partial y_j sum_i (y_i-t_i)^2\&= fracpartial partial y_j left[(y_j-t_j)^2 + sum_i ne j (y_i-t_i)^2right]\&= fracpartial partial y_j left[(y_j-t_j)^2right] + left[fracpartialpartial y_j sum_i ne j (y_i-t_i)^2right]
\&=2(y_j-t_j) fracpartial (y_j-t_j)partial y_j +0\&=2(y_j-t_j) endalign
Hence $$nabla_y L=2(y-t)$$
Note that $y^Tt=t^Ty$, here all my vectors are column vectors.
beginalignfracpartial Lpartial y_j&=fracpartial partial y_j sum_i (y_i-t_i)^2\&= fracpartial partial y_j left[(y_j-t_j)^2 + sum_i ne j (y_i-t_i)^2right]\&= fracpartial partial y_j left[(y_j-t_j)^2right] + left[fracpartialpartial y_j sum_i ne j (y_i-t_i)^2right]
\&=2(y_j-t_j) fracpartial (y_j-t_j)partial y_j +0\&=2(y_j-t_j) endalign
Hence $$nabla_y L=2(y-t)$$
Note that $y^Tt=t^Ty$, here all my vectors are column vectors.
edited Sep 9 at 13:50
answered Sep 9 at 13:39
Siong Thye Goh
82.9k1456104
82.9k1456104
Care to explain why it is equal to $2(y_j-t_j) fracpartial (y_j-t_j)partial y_j $ ? I guess by chain rule? Can you please write down the full calculation?
â sheldonzy
Sep 9 at 13:46
I have added more details.
â Siong Thye Goh
Sep 9 at 13:50
Thanks! Just checking: it is $fracpartial (y_j-t_j)partial y_j $ because you are actually doing $fracLpartial (y_j-t_j) cdot fracpartial (y_j-t_j)partial y_j $ Right?
â sheldonzy
Sep 9 at 13:57
yup, that is just chain rule.
â Siong Thye Goh
Sep 9 at 14:01
add a comment |Â
Care to explain why it is equal to $2(y_j-t_j) fracpartial (y_j-t_j)partial y_j $ ? I guess by chain rule? Can you please write down the full calculation?
â sheldonzy
Sep 9 at 13:46
I have added more details.
â Siong Thye Goh
Sep 9 at 13:50
Thanks! Just checking: it is $fracpartial (y_j-t_j)partial y_j $ because you are actually doing $fracLpartial (y_j-t_j) cdot fracpartial (y_j-t_j)partial y_j $ Right?
â sheldonzy
Sep 9 at 13:57
yup, that is just chain rule.
â Siong Thye Goh
Sep 9 at 14:01
Care to explain why it is equal to $2(y_j-t_j) fracpartial (y_j-t_j)partial y_j $ ? I guess by chain rule? Can you please write down the full calculation?
â sheldonzy
Sep 9 at 13:46
Care to explain why it is equal to $2(y_j-t_j) fracpartial (y_j-t_j)partial y_j $ ? I guess by chain rule? Can you please write down the full calculation?
â sheldonzy
Sep 9 at 13:46
I have added more details.
â Siong Thye Goh
Sep 9 at 13:50
I have added more details.
â Siong Thye Goh
Sep 9 at 13:50
Thanks! Just checking: it is $fracpartial (y_j-t_j)partial y_j $ because you are actually doing $fracLpartial (y_j-t_j) cdot fracpartial (y_j-t_j)partial y_j $ Right?
â sheldonzy
Sep 9 at 13:57
Thanks! Just checking: it is $fracpartial (y_j-t_j)partial y_j $ because you are actually doing $fracLpartial (y_j-t_j) cdot fracpartial (y_j-t_j)partial y_j $ Right?
â sheldonzy
Sep 9 at 13:57
yup, that is just chain rule.
â Siong Thye Goh
Sep 9 at 14:01
yup, that is just chain rule.
â Siong Thye Goh
Sep 9 at 14:01
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2910787%2fhow-to-differentiate-sum-iy-i-t-i2-by-y%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
$y=(y_1,y_2,ldots,y_n)$?
â MathOverview
Sep 9 at 13:38
@MathOverview Yes sorry
â sheldonzy
Sep 9 at 13:39
Question. In equality "(1)" would not $ vectcdot vect^T $ be in place of $ vectcdotvect$?
â MathOverview
Sep 9 at 13:41