Logic regression of "machine learning"

Source: Internet
Author: User
Keywords Machine learning linear algebra logistic regression machine learning simplification Tutorial
Tags cost function functions get high learning not high
"Machine learning" logic regression advantage: The calculation cost is not high, easy to understand and realize, disadvantages: easy to fit, classification accuracy may not be high.

What we want is to receive all the input and then predict the category. Output 0 or 1 in the case of two classes. A function of this nature, perhaps the original you have contacted, is called the Heaviside step function, that is, the unit steps functions. But this momentary jump is actually difficult to deal with. So, here we take the sigmoid function.
G (z) =11+e?z

In order to achieve the logistic regression classifier, we take a regression coefficient in each feature, add all the results, and bring this sum into the sigmoid function to get a numerical value between the 0~1. Any number greater than 0.5 is divided into 1 categories, and less than 0.5 is divided into 0 categories. So the question becomes what is the optimal regression coefficient?

Gradient Descent method

To get the optimal value of the function, we need to know the direction of the optimal value and the moving quantity that needs to be moved to the optimal value. Gradient operator is the fastest way to decrease function value. The move is called the step length, which is the alpha.
With a set of training set {(x1,y1),..., (Xm,ym)},m is the sample number, for each sample xi,xi=[xi1,... xin]t,y=[0,1], we multiply the best coefficient theta to get
hθ (x) =11+e?θtx
The equation for the cost function is as follows:
Cost (hθ (x), y) ={?log (hθ (x)), log (1?hθ (x)) ify=1ify=0
J (θ) =1m∑i=0mcostfunction (hθ (xi), Yi) =?1m[∑i=0myilog (hθ (xi) + (1?yi) log (1?hθ) (xi))]

Related Article

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.