Machine Learning Lecture Note 004 -- Classification

Classification vs. Regression

Regression can take continuous output values, while classification can only take discrete values. (0,1,etc.)

Binary classification problems have output values 0 or 1.

Use linear regression and map all predictions greater than 0.5 as a 1 and all less than 0.5 as a 0 doesn’t work well because classification is not actually a linear function.

Logistic function (Sigmoid)

在这里插入图片描述
The graph looks like:
在这里插入图片描述
h θ ( x ) h_{\theta}(x) hθ(x) gives us the probability of output = 1 given x x x, on the other hand, 1 − h θ ( x ) 1-h_{\theta}(x) 1hθ(x) gives us the probability of output = 0 given x x x.

When h θ ( x ) > = 0.5 h_{\theta}(x) >= 0.5 hθ(x)>=0.5 output = 1, otherwise output = 0.

Therefore, we can say that when θ T x > = 0 \theta^{T}x >=0 θTx>=0, we have output = 1, otherwise output = 0.

Decision Boundary

A property of the Logistic Function that separates h θ ( x ) h_{\theta}(x) hθ(x) = 1 & h θ ( x ) h_{\theta}(x) hθ(x) = 0

Boundary itself is the set of points that yields h θ ( x ) h_{\theta}(x) hθ(x) = 0.5.

Cost function

Linear regression cost function won’t work because Logistic function makes it non-convex (has a lot of local optima)

Cost function for Logistic Function is:
在这里插入图片描述

For y = 1, the function looks like:
在这里插入图片描述

For y = 0, the function looks like:

在这里插入图片描述
Here are the properties of Logistic cost function:
在这里插入图片描述
We can further compress our cost function to:
在这里插入图片描述
Then we make it applicable to multivariate situation:
在这里插入图片描述

Gradient descent for classification problem

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值