conclusion

Logistic regression is obtained on the basis of linear regression model. Specifically, the activation function is introduced on the basis of the linear model, and the uncertainty of linear regression results is mapped to [0,1], which is called a probability problem. Linear regression, mainly to solve the regression problem, its output is unlimited. Logistic regression, which is used to solve classification problems, maps the output of the activated function to the range [0,1]. It's a probability problem, and setting a threshold is the perfect way to solve the classification problem.Copy the code

1/ The distinction between logistic regression and linear regression

<1> Both logistic regression and linear regression are first of all generalized linear regression. <2> the optimization objective function of the classical linear model is the least squares, while logistic regression is the likelihood function <3> linear regression makes predictions in the whole real number field with consistent sensitivity, while logistic regression needs to be in the range of [0,1]. <4> Logistic regression model equation is composed of linear regression model equation and Sigmoid function. <5> Linear regression: y = w0x0+ W1x1 +w2x2+...... + WNXN, no matter how many independent variables there are, as long as the independent variables are first order, it's linear, it's an equation that looks like a straight line in n-dimensional space. <6> Logistic regression z = w0x0+ W1x1 +w2x2+...... + WNXN then put z into sigmoid() function <7> logistic regression is a regression model that reduces the prediction range and limits the predicted value to between [0,1]. Therefore, for such problems, logistic regression has better robustness than linear regression. <8> In other words, linear regression model can not achieve the nonlinear form of SIGmoID, sigmoID can easily deal with 0/1 classification problem. <9> Logistic regression is a classification model despite the word "regression" in its name. To solve dichotomies. <10> Logistic regression deals with classification problems, while linear regression deals with regression problems. <11> Logistic regression does not require variables, but linear regression requires variables to be independent of each other, that is to say, there should be no relationship between variables. If necessary, principal components can be extracted through PCA dimension reduction. (extract principal component, exactly is to extract a few principal components, is determined according to the variance of ratios, if < 10%, then you can ignore) logistic regression is essentially linear regression, only the results of characteristics to the map to add a layer of function mapping, namely the characteristics of linear summation first, and then use the function g (z) to predict the most assume that function. G (z) can map continuous values between 0 and 1 (this is a probability). Substitute g(z) into the expression of the linear regression model to obtain the expression of logistic regression:Copy the code

Logistic regression: <1> Dichotomous if the activation function is sigmoid(). <2> Multi-dichotomous if the activation function is Softmax ().Copy the code