本文主要是介绍第一周-机器学习-代价函数_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”指的是下图右边轮廓图某一条线。
- “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”指的是下图右边轮廓图某一条线。
注:图片来源都为 机器学习-吴恩达 中的视频截图
这篇关于第一周-机器学习-代价函数_intuition的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!