接上文, 本文中讨论其他 regression 中的 不同 cost function.
回顾 Linear regression 中hypothesis function 的 output value 为连续值.
若 input values 是一组判断是否问题的条件. 则 output value 是 .
若 input values 同是一组判断条件, 即 output value 是非连续离散的值 .
先来讨论 时, 选哪个 regression algorithm 及 cost function.
当然可以使用 perception ( 感知机 ) 去解决这种分类问题, 但这里所述以 regression 思想去解决这种二分问题. perception 模型后续会写.
考虑怎么使连续的 input values 映射到 集合中呢?
假设把 input values 通过某一 hypothesis function 使 , 且 映射到 以如下规则:
以 为分界点, 如果 则 , 则 .
如果 ,则 离 1 越近越好,反之 则 离 0 越近越好.
cost function 可以表示为
也可以写成这样一个式子:
使 cost function 值越小 是, 让 等于或无穷接近 .
回想上一文, 其实 .
同样 对 求偏导, ( 求最大斜率, 迭代 )
为了计算方便, 先取对数, 在求偏导.( 过程暂时省略, 稍后会给出 )