gradient descent seems to fail

前端 未结 9 1951
忘掉有多难
忘掉有多难 2020-12-12 15:54

I implemented a gradient descent algorithm to minimize a cost function in order to gain a hypothesis for determining whether an image has a good quality. I did that in Octav

9条回答
  •  臣服心动
    2020-12-12 16:15

    If you are OK with using a least-squares cost function, then you could try using the normal equation instead of gradient descent. It's much simpler -- only one line -- and computationally faster.

    Here is the normal equation: http://mathworld.wolfram.com/NormalEquation.html

    And in octave form:

    theta = (pinv(X' * X )) * X' * y
    

    Here is a tutorial that explains how to use the normal equation: http://www.lauradhamilton.com/tutorial-linear-regression-with-octave

提交回复
热议问题