首页 > 系统服务 > 详细

Machine learning(2-Linear regression with one variable )

时间:2021-06-08 13:40:06      阅读:21      评论:0      收藏:0      [点我收藏+]

1、Model representation

  • Our Training Set [训练集]:

技术分享图片

  • We will start with this ‘’Housing price prediction‘’ example first of fitting linear functions, and we will build on this to eventually have more complex models

技术分享图片

2、Cost function

  • 代价函数(平方误差函数):It figures out how to fit the best possible straight line to our data
  • So how to choose θi‘s ?

技术分享图片

  • and just try:

技术分享图片

  • The parameters we choose determine the accuracy of the straight line we get relative to our training set
  • But there is modeling error 建模误差

技术分享图片

  • Our goal is to select the model parameters that minimize the sum of squares of modeling errors

  • That is to minimize the cost function!技术分享图片

  • summary:

技术分享图片

2-1、Cost function introduction I

  • We look up some plots to understand the cost function

技术分享图片

2-2、Cost function introduction II

  • Let‘s take a look at the three-dimensional space diagram of the cost function(also called a convex function 凸函数)

技术分享图片

  • And here is an example of a contour figure:

技术分享图片

  • The contour figure is a more convenient way to visualize the cost function

3、Gradient descent

  • It turns out gradient descent(梯度下降) is a more general algorithm and is used not only in linear regression. I will introduce how to use gradient descent for minimizing some arbitrary function J
  • 技术分享图片
  • 技术分享图片
  • The formula of the batch gradient descent algorithm :

技术分享图片

4、Gradient descent intuition

  • Derivative term purpose :get closer to the minimum

  • 技术分享图片

  • Learning rate α

技术分享图片

  • But what if my parameter θ1 is already at a local minimum?
  • 技术分享图片
  • Gradient descent can converge to a local minimum, even with the learning rate α fixed
  • 技术分享图片

5、Gradient descent for linear regression

  • 技术分享图片

  • 技术分享图片

  • 技术分享图片

Machine learning(2-Linear regression with one variable )

原文:https://www.cnblogs.com/wangzheming35/p/14861404.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!