栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

吴恩达机器学习笔记三(Machine learning algorithms--Cost function)

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

吴恩达机器学习笔记三(Machine learning algorithms--Cost function)

Cost function

We need to remember this:

1、Understand the cost function

In order to simplify:

Use h θ ( x ) = θ 1 x h_theta(x)=theta_1x hθ​(x)=θ1​x

Each value of theta one corresponds to a different hypothesis(不同的 θ 1 theta_1 θ1​对应不同的假设函数) .And for each value of theta one( θ 1 theta_1 θ1​), We could then derive a different value of J of theta one( J ( θ 1 ) J(theta_1) J(θ1​))

For example: Here are a data set, include three point(1, 1)、point(2, 2)、point(3, 3).

2、What the cost function is doing

Here is the training set of housing prices:

Let’s make some hypothesis:

Such as: θ 1 = 0.06 , θ 0 = 50 theta_1 = 0.06,quad theta_0=50 θ1​=0.06,θ0​=50… We can also draw the corresponding J ( θ 0 , θ 1 ) J(theta_0,theta_1) J(θ0​,θ1​), and the figure is shown below:

the axes are labeled θ 0 theta_0 θ0​ and θ 1 theta_1 θ1​ , As we vary θ 0 theta_0 θ0​ and θ 1 theta_1 θ1​, the two parameters, we get different values of the cost function J ( θ 0 , θ 1 ) J(theta_0,theta_1) J(θ0​,θ1​), and the height of the surface of the points indicates the value of J J J of θ 0 theta_0 θ0​ and θ 1 theta_1 θ1​

NOW for the purpose of illustration in the rest of this note, we are not actually going to use these sort of 3D surfaces to show the cost function J, instead we are going to use contour plots(等高线,越靠近圆心值越小), for example:

As is shown above, each of these ovals, what each of these ellipses shows is a set of points that takes on the same value for J ( θ 0 , θ 1 ) J(theta_0,theta_1) J(θ0​,θ1​). Think about the values of of the cost function J , how that corresponds to different hypothesis, as how better hypothesis may corresponds to points that are closer to the minimum of this cost function J.

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/700489.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号