I. Introduction logistic regression
1 machine learning methods, logistic regression (Logistic regression) for solving a binary (0 or 1) the problem, i.e., the party is a classification algorithm.
• Typical applications:
• image classification
• Spam Detection
• the purchase of goods prediction
• ...
2, Sigmoid function
Sigmoid function, also called logical function (Logistic function)
Intuitive understanding
• arbitrary input mapping to the [0,1] linear regression we can get a predicted value, then the value is mapped to the Sigmoid function thus completing the conversion by the value of the probability, that is, the classification task .
3, logistic regression linear regression vs
Are regression
• objective regression is a linear regression (-∞, + ∞) • logistic regression regression target is (0, 1), it is often used as a classification
• We will fit a regression function on P (Y = 1 | X)
linear regression----> logistic regression
4, logistic regression
for binary classification problem, we can:
We will f (x, w) seen as a possibility (probability), then we can get:
5, maximum likelihood probabilities
for all N samples, all of the correct classification probability is
So our goal is to maximize J (w).
6, the log-likelihood probability
will not optimize the expression directly, then we logarithmic
So our goal is to maximize L (w)
7、最大log似然求解
We could learn w by maximizing the log likelihood using gradient ascent
二、二分类分类器处理多分类问题
- 一对多(One v.s. other)
- 一对一(One v.s. One)
二分类扩展到多分类
一对多(One v.s. other) • 区分[cat, dog, bird]
• 二值分类器:clf_bin
• 猫的分类器:
• if_cat = clf_bin((X_cat,Y_cat), (X_ncat,Y_ncat))
• 狗的分类器:
• if_dog = clf_bin((X_dog,Y_dog), (X_ndog,Y_ndog))
• 鸟的分类器:
• if_bird = clf_bin((X_bird, Y_bird), (X_nbird, Y_nbird))
1、一对多(One v.s. other)
一对多(One v.s. other)
- 分类,输入样本x
- 使用if_cat, if_dog, if_bird三个分类器进行分类
- 哪个分类器的值大就是哪一类
二分类扩展到多分类
一对一(One v.s. One) • 区分[cat, dog, bird]
• 二值分类器:clf_bin
• 猫/狗的分类器:catdog_clf = clf_bin(..,..)
• 猫/鸟的分类器:catbird_clf = clf_bin(..,...)
• 狗/鸟的分类器:dogbird_clf = clf_bin(..,..)
1、一对一(One v.s. One)
- 分类,输入样本x
- 使用catdog_clf, catbird_clf, dogbird_clf三个分类器进行分类
-
然后进行投票,票数多赢,比如两个分类器都投cat,那么就是cat