逻辑回归(三)

作者: SmallRookie | 来源:发表于2017-08-21 20:43 被阅读51次
多类别分类(Multiclass Classification)

在多类别分类问题中,我们的训练集中有个多个类别,这时可以利用一对多的分类思想将多类别分类问题转化为二元分类问题,该方法也称为一对多分类方法。

我们分别令y=1,y=2和y=3分别表示图中的三角形、矩形和叉。

左数第一个图y=1标记为正向类,则其他的就为负向类,这时我们就可以画出图中的直线作为边界,则记假设函数为hθ(1)(x),以此类推,第二个和第三个图的假设函数可分别记为hθ(2)(x),hθ(3)(x)。

因此,我们可以将假设函数hθ(x)记为:hθ(i)(x) = p(y=i|x,θ),其中i=1,2,3,...

最后,我们分别运行hθ(i)(x),i=1,2,3,...,选出让hθ(i)(x)的值最大的i,这时我们就挑选出了最好的假设函数,即最好的分类器。

补充笔记
Multiclass Classification: One-vs-all

Now we will approach the classification of data when we have more than two categories. Instead of y = {0,1} we will expand our definition so that y = {0,1...n}.

Since y = {0,1...n}, we divide our problem into n+1 (+1 because the index starts at 0) binary classification problems; in each one, we predict the probability that 'y' is a member of one of our classes.

We are basically choosing one class and then lumping all the others into a single second class. We do this repeatedly, applying binary logistic regression to each case, and then use the hypothesis that returned the highest value as our prediction.

The following image shows how one could classify 3 classes:

To summarize:

Train a logistic regression classifier hθ(x) for each class to predict the probability that y = i .

To make a prediction on a new x, pick the class that maximizes hθ(x)

相关文章

  • 逻辑回归(三)

    多类别分类(Multiclass Classification) 在多类别分类问题中,我们的训练集中有个多个类别,...

  • 机器学习day7-逻辑回归问题

    逻辑回归 逻辑回归,是最常见最基础的模型。 逻辑回归与线性回归 逻辑回归处理的是分类问题,线性回归处理回归问题。两...

  • ML03-逻辑回归(下部分)

    本文主题-逻辑回归(下部分):逻辑回归的应用背景逻辑回归的数学基础逻辑回归的模型与推导逻辑回归算法推导梯度下降算法...

  • ML02-逻辑回归(上部分)

    本文主题-逻辑回归(上部分):逻辑回归的应用背景逻辑回归的数学基础逻辑回归的模型与推导逻辑回归算法推导梯度下降算法...

  • 线型回归、逻辑回归和神经网络的区别

    一、线型回归(Linear regression) 二、梯度下降(Gradient descent) 三、逻辑回归...

  • 逻辑回归模型

    1.逻辑回归介绍2.机器学习中的逻辑回归3.逻辑回归面试总结4.逻辑回归算法原理推导5.逻辑回归(logistic...

  • Task 01|基于逻辑回归的分类预测

    知识背景 关于逻辑回归的几个问题 逻辑回归相比线性回归,有何异同? 逻辑回归和线性回归最大的不同点是逻辑回归解决的...

  • 11. 分类算法-逻辑回归

    逻辑回归 逻辑回归是解决二分类问题的利器 逻辑回归公式 sklearn逻辑回归的API sklearn.linea...

  • 机器学习100天-Day4-6逻辑回归

    逻辑回归(Logistic Regression) 什么是逻辑回归 逻辑回归被用于对不同问题进行分类。在这里,逻辑...

  • 逻辑回归(Logistic Regression)

    重点事情说三遍!!! 逻辑回归虽然名字叫回归,但它是正经的分类方法!分类方法!分类方法! 1. 逻辑回归 假如我们...

网友评论

    本文标题:逻辑回归(三)

    本文链接:https://www.haomeiwen.com/subject/rmjhdxtx.html