当前位置:网站首页>Linear regression and logistic regression

Linear regression and logistic regression

2022-07-06 02:54:00 uncle_ ll

Linear regression is a regression problem , Logistic regression is a classification problem .

Linear regression

Labels are consecutive floating-point numbers , For example, based on the area of the house 、 Location and other predicted house prices , Forecast weather based on historical weather and other related issues . The prediction formula is as follows :
Y = X ∗ W + b Y = X*W + b Y=XW+b

Logical regression

For linearly separable cases , Two types of data can be distinguished by a straight line , such as :

 Insert picture description here
Suppose the label at the top left of this red line is 1, The label at the bottom right of the red line is 0, be X 1 X_1 X1 And X 3 X_3 X3 Belong to 1, X 2 X_2 X2 Belong to 0 class .
But this way is not very intuitive , There's no better way ? The answer is yes , Further normalization through logical functions
 Insert picture description here
The above is a logic function , Role is to z Map to the value of , The mapping range is [ 0 ,   1 ] [0,~1] [0, 1]:

  • If z The value is greater than 0, After being processed by logic function , The scope is [ 0.5 , 1 ] [0.5, 1] [0.5,1]
  • If z The value is less than 0, After being processed by logic function , The scope is [ 0 , 0.5 ] [0, 0.5] [0,0.5]

Now we can calculate the probability of each point leaving :
 Insert picture description here
You can see , X 1 X_1 X1 Point belongs to 1 The probability is greater than X 1 X_1 X1 Point belongs to 0 Probability .

原网站

版权声明
本文为[uncle_ ll]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202132344388838.html