吴恩达机器学习公开课学习笔记(一)

吴恩达机器学习公开课学习笔记(一)


公开课链接: https://study.163.com/course/courseLearn.htm?courseId=1004570029#/learn/video?lessonId=1049101127&courseId=1004570029

一些规范表达形式

训练集中样本数目: m m
变量: X X ,自变量的第i个样本: X ( i ) X^{(i)}
目标: Y Y ,目标的第i个样本: Y ( i ) Y^{(i)}
映射函数: h h ,hypothesis,把 x y x\rightarrow y ,表达形式: h θ ( x ) = θ 0 + θ 1 x h_\theta(x)=\theta_0+\theta_1x (线性函数)

线性回归/单变量线性回归

映射函数: h θ ( x ) = θ 0 + θ 1 x h_\theta(x)=\theta_0+\theta_1x
θ 0 θ 1 \theta_0和\theta_1 为模型参数(parameters of model)
优化过程就是最小化函数: min θ 0 , θ 1 1 2 m i = 1 m h θ ( x ( i ) ) y ( i ) 2 \min_{\theta_0,\theta_1} \frac{1}{2m}\sum_{i=1}^m|h_\theta(x^{(i)})-y^{(i)}|^2 最小化误差平方和
系数 1 2 m \frac{1}{2m} 是为了让数值不那么大
为了让这个概念更明晰,所以定义了代价函数(cost function)
代价函数 J ( θ 0 , θ 1 ) J(\theta_0,\theta_1) : J ( θ 0 , θ 1 ) = 1 2 m i = 1 m h θ ( x ( i ) ) y ( i ) 2 J(\theta_0,\theta_1)=\frac{1}{2m}\sum_{i=1}^m|h_\theta(x^{(i)})-y^{(i)}|^2
目标就是minimize cost function,代价函数也被称作平方误差函数(squared error function)

代价函数

Hypothesis: h θ ( x ) = θ 0 + θ 1 x h_\theta(x)=\theta_0+\theta_1x
Parameters: θ 0 θ 1 \theta_0和\theta_1
Cost function: J ( θ 0 , θ 1 ) = 1 2 m i = 1 m h θ ( x ( i ) ) y ( i ) 2 J(\theta_0,\theta_1)=\frac{1}{2m}\sum_{i=1}^m|h_\theta(x^{(i)})-y^{(i)}|^2
Goal: min θ 0 , θ 1 J ( θ 0 , θ 1 ) \min_{\theta_0,\theta_1}J(\theta_0,\theta_1)

猜你喜欢

转载自blog.csdn.net/ciecus_csdn/article/details/84744308