Review machine learning algorithms: Logistic regression

Source: Internet
Author: User

    

Unlike linear regression, instead of multiplying each feature directly by its coefficients, it uses an S-type function (the logistic function). As follows:

The reason for using this form function (probability, derivation).

The cost function, also not the sum of squared errors in linear regression, is based on the logarithmic likelihood function, as follows:

The posterior probability of a single sample is: (y = 0, 1) A probability density function similar to the two-item distribution.

Posteriori probabilities for the entire sample set:


The logarithmic likelihood function is for the cost function, as follows:

The gradient descent method solves the above cost function, which is as follows:


The error is multiplied by the corresponding attribute value and then summed. form and linear regression are consistent, explaining why such S-type functions and cost functions are designed. The calculation of this gradient descent method is simple.

The advantages of LR regression are as follows: The calculation is small, the derivation formula can be seen from the gradient descent method, and nonlinear data can be processed.

Cons: Easy to fit.

How to avoid overfitting:

(1) dimensionality reduction, can use PCA algorithm to reduce the dimension of the sample, so that the number of theta of the model is reduced, the number of times will be reduced, to avoid overfitting;

(2) regularization, the design of regular items regularization term.

The regularization function is to prevent some properties before the coefficient weight is too large, there has been a fitting.

Note that the way to resolve overfitting in LR regression differs from the method that is resolved in the decision tree.

Review machine learning algorithms: Logistic regression

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.