Logistic regression learning and C + + implementation

Source: Internet
Author: User

Logistic regression is a classification method, which is used for two classification problems, and its basic idea is:

  1. Look for the appropriate hypothesis function, the classification function, to predict the results of the input data;
  2. The structure loss function is used to indicate the deviation between the predicted output and the actual classes in the training data;
  3. 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

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.