[Machine Learning] Simplified Cost Function and Gradient Descent

We can compress our cost function's two conditional cases into one case:

We can fully write out our entire cost function as follows:

A vectorized implementation is:

Gradient Descent

Remember that the general form of gradient descent is:

We can work out the derivative part using calculus to get:

Notice that this algorithm is identical to the one we used in linear regression. We still have to simultaneously update all values in theta.

A vectorized implementation is:

posted @ 2020-08-28 04:07  Zhentiw  阅读(141)  评论(0编辑  收藏  举报