Machine learning--Logistic regression

Source: Internet
Author: User

Before we discuss logistic Regression , let's discuss some real-life scenarios: Determine if an e-mail message is spam? Determine if a transaction is a fraudulent transaction? Determine if a document is a valid document? This kind of problem, we call classification problem (classication problem). In the classification problem, we often try to predict whether the result belongs to a certain class (correct live error).

We start with the two-dollar classification problem, that is, the problem is correct or wrong.

We will refer to the two classes that the dependent variable (Dependent Variable) might belong to, called the Negative class (negativeClass), respectively. and forward classes (PositiveClass), the dependent variable:


where 0 represents a negative class, and 1 indicates a forward class

We hypothesized that predicting whether a tumour is a classification problem for malignant tumors (malignant or benign), we assume that the tumor is malignant or benign in relation to tumor size, A linear regression method can be used to find a line suitable for the data:


According to the linear regression model, we can only predict the continuous values, and then for the classification problem, we only need to output 0 or 1, we could predict:


For the data shown, such a linear model seems to do a good job of classifying tasks. Suppose we observe a very large malignant tumor and add it to our training set as a new instance, then we will have some influence on our linear model and get a new line.


At this point, it is not appropriate to use 0.5 as a threshold to predict whether a tumour is benign or malignant. As can be seen, the linear regression model, because its predicted value can go beyond the [0,1] range, so it is not suitable for solving such problems.

We introduce a new model, the logistic regression, that the output variable range of the model is moderate between 0 and 1.

The assumptions of the logistic regression model are:


Which explains some of the identities:


The image of the function is:


By combining the logical function with the hypothetical function, we get the hypothesis of the logistic regression model:


For the model, you can have the following understanding:

H? The effect of (x) is that for a given input variable, the probability of the output variable =1 (estimated probablity)is computed based on the selected parameters, i.e.:

For example, if the given x is calculated by an already determined parameter, H? (x) = 0.7, it means that there is a probability of 70% y is a forward class, corresponding, Y is a negative class probability of 30% (1-0.7=0.3).

As above, it is the logistic regression model. Next time we discuss the decision boundary (decision boundary) and the cost function .



Machine learning--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.