[Stanford] II. Supervised Learning: Linear Regression

Source: Internet
Author: User

Supervised Learning

Learn a function H: X → y

H is called a hypothesis.

1. Linear Regression

In this example, X is a two-dimensional vector, x1 represents living area, and x2 represents bedrooms.

Functions/hypotheses H

Set X0 = 1.

Now, given a training set, how do we pick, or learn, the parameters θ? Now it is used to evaluate the θ parameter.

One reasonable method seems to be to make h (x) close to y,

We define the cost function: defines the loss function:

To minimize the value of this function

1. LMS algorithm: Least Mean Square

We want to choose θ so as to minimize J (θ ).

Gradient Descent Algorithm

α is called the learning rate.

LMS update Rule

Called batch Gradient Descent

Algorithm:

Every θ in each loop, for example, θ J must be updated m times, I = 1, 2 ,... M and M are the number of elements in the training set.

If M is too large, the algorithm will be slow. Instead, use the random gradient descent method.

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.