4
$\begingroup$

A cost function used in machine is often the following

$$C = \frac{1}{2} \| y - \hat{y} \| ^2$$

Why is there $\frac{1}{2}$ in front of the squared distance?

$\endgroup$
4
$\begingroup$

To simplify the derivative, probably. Otherwise there will be constant 2 in it.

$\endgroup$
  • 2
    $\begingroup$ This is the correct answer. The constant factor does not affect the optimizer of the loss, so the only reason is convenience. $\endgroup$ – Harsh Feb 23 '17 at 21:16
  • $\begingroup$ I think it would also useful if you explain in which way it exactly simplifies the derivative (i.e. show a step by step example). $\endgroup$ – nbro Apr 1 at 13:56
  • $\begingroup$ @Harsh Yes, but I think these details should be elaborated a little more (i.e. explained more in detail), given that they might not obvious to everyone, so this question needs to be improved, IMHO. $\endgroup$ – nbro Apr 1 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.