Logistic regression is a classification method, which is used for two classification problems, and its basic idea is:
- Look for the appropriate hypothesis function, the classification function, to predict the results of the input data;
- The structure loss function is used to indicate the deviation between the predicted output and the actual classes in the training data;
- Minimize the loss function to obtain optimal model parameters.
First look at the sigmoid function:
\ (g (x) =\frac{1}{1-e^{x}}\)
Its function image is:
Hypothetical functions in logistic regression (classification Functions):
\ (H_{\theta} (x) =g (\theta ^{t}x) =\frac{1}{1+e^{-\theta ^{t}x}}\)
Explain:
\ (\theta \)--The parameters we request at the back;
\ (t\)--vector transpose, the default vector is the column vector;
\ (\theta ^{t}x\)--column vector \ (theta\) first transpose, then with \ (x\) to do the point multiplication, for example:
\ (\begin{bmatrix}1\\ -1\\ 3\end{bmatrix}^{t}\begin{bmatrix}1\\ 1\\ -1\end{bmatrix} = \begin{bmatrix}1 &-1 & 3\ end{bmatrix}\begin{bmatrix}1\\ 1\\ -1\end{bmatrix}=1\times 1+ ( -1) \times1+3\times (-1) = -3\)
Logistic regression learning and C + + implementation