第一周-机器学习-代价函数_intuition

  • 这仅是本人在cousera上学习机器学习的笔记,不能保证其正确性,谨慎参考

1、算法模型,hypothesis(假设),h表示x到y的映射函数:
这里写图片描述

2、单值线性回归举例分析
这里写图片描述
3、J为平方误差代价函数(squared error function),为什么除以2*m问不是除以m,视频中说除以2是为求最小值。
这里写图片描述
4、代价函数(cost function)说明:
“The mean is halved (1/2) as a convenience for the computation of the gradient descent, as the derivative term of the square function will cancel out the 1/2 term. ”乘以1/2作为梯度下降的便利,当平方函数求导之后乘以1/2的作用将被抵消
这里写图片描述
4、代价函数的直观感受(cost function intuition)
问题说明:
这里写图片描述
5、简化问题分析,先假设 θ0=0,得到下图,3个红×为训练集,黑线为 θ1=0.5时的映射函数,此时算出“各蓝线的距离差之和/2*3”为0.58,在代价函数中汇出点(0.5,0.58):
这里写图片描述
6、画出代价函数,取代价函数(值越小拟合(fit through)效果越好)的最小值即为target:
这里写图片描述

7、没有简化的intuition:

  • 3维表示:
    这里写图片描述

  • 轮廓图表示,其中图中的3个点表示3对不相等的(θ0,θ1)值,但他们对应的J(θ0,θ1)是相等的,越靠近中心圆,说明拟合效果越好。该图的形成过程可以看做是从上面的3维图中用z=c(c为常数)平面去切割得到的,c一个值对应轮廓图中一条线,对应一组J(θ0,θ1)相等的参数对(θ0,θ1):
    这里写图片描述

    • “Taking any color and going along the ‘circle’, one would expect to get the same value of the cost function. For example, the three green points found on the green line above have the same value for J(θ0,θ1) and as a result, they are found along the same line”这里最后的“the same line”指的是下图右边轮廓图某一条线。
      这里写图片描述

注:图片来源都为 机器学习-吴恩达 中的视频截图

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值