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

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

吴恩达机器学习笔记三(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.

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5700609.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存