成本函数

Cost Function

We can measure the accuracy of our hypothesis function by using acost function. This takes an average difference (actually a fancier version of an average) of all the results of the hypothesis with inputs from x's and the actual output y's.

J(θ0,θ1)=12m∑i=1m(y^i−yi)2=12m∑i=1m(hθ(xi)−yi)2

To break it apart, it is12x¯wherex¯is the mean of the squares ofhθ(xi)−yi, or the difference between the predicted value and the actual value.

This function is otherwise called the "Squared error function", or "Mean squared error". The mean is halved(12)as a convenience for the computation of the gradient descent, as the derivative term of the square function will cancel out the12term. The following image summarizes what the cost function does:


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 在这个飞速发展变化的时代,每个都有自己的焦虑,唯恐跟不上时代发展的脚步,进而落后被淘汰,学习成长成为了这个...
    baer阅读 329评论 0 1
  • 岁月 荏苒了所有 蹉跎了回眸 揭开我的伤 带走我的人 眼泪滑过所有的梦 ————苏沫。
    sumo_阅读 236评论 1 1
  • 上周末,大雨,出门办事顺便跟相识二十几年的医生朋友一起吃饭。 饭桌上聊到一个远亲最近来检查身体,起初是四肢无力,在...
    Miss饭拖拖阅读 744评论 0 1