Machine learning(2-Linear regression with one variable )
2021/6/8 10:27:36
本文主要是介绍Machine learning(2-Linear regression with one variable ),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
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 )的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23增量更新怎么做?-icode9专业技术文章分享
- 2024-11-23压缩包加密方案有哪些?-icode9专业技术文章分享
- 2024-11-23用shell怎么写一个开机时自动同步远程仓库的代码?-icode9专业技术文章分享
- 2024-11-23webman可以同步自己的仓库吗?-icode9专业技术文章分享
- 2024-11-23在 Webman 中怎么判断是否有某命令进程正在运行?-icode9专业技术文章分享
- 2024-11-23如何重置new Swiper?-icode9专业技术文章分享
- 2024-11-23oss直传有什么好处?-icode9专业技术文章分享
- 2024-11-23如何将oss直传封装成一个组件在其他页面调用时都可以使用?-icode9专业技术文章分享
- 2024-11-23怎么使用laravel 11在代码里获取路由列表?-icode9专业技术文章分享
- 2024-11-22怎么实现ansible playbook 备份代码中命名包含时间戳功能?-icode9专业技术文章分享