Friday, May 17, 2013

Linear Regression with One Variable

As i have mentioned in "What is Machine Learning?" Regression method use for predicting continuous variable.
Lets start with example predict the house price according to size. We're going to use a data
set of housing prices from the Delhi City. Here I'm going to plot my data set of a number of houses
that were different sizes that were sold for a range of different prices.




 Let's say somebody wanted to sell house of 1350 square. feet. We want to tell him/her how much they might be able to sell the
house for.
Well one thing we could do is fit a model. Maybe fit a straight line to this data. Looks something like that and based on that, maybe we could tell him/her that let's say maybe he/she can sell the house for around 2500,000.


It's a regression problem where the term regression refers to the fact that we are predicting a real-valued output namely the price.




Lets use x(i), y(i)) just refers to the ith row of this below table. 


So for example, x(1) refers to the input value for the first training example to predict output value y(1).

From this training data we make hypothesis to predict house price from house size.

Flow of process is shown below figure :


Here h represent Hypothesis, which maps from X(Size of House) to Y(Estimated Price).

h(x) =  Θ0   +  Θ1(x) 

Regression Line represents as shown in below figure :





Below figures shows Regression Line(Hypothesis) for different   Θand  Θ1.





Goal : Goal for each regression line is chose  Θ0 , Θ  as where h(x) close to y(output value).
Goal of each training iteration is to minimize the squared error. Cost function of this Regression line is :

M : Number of training example

This complete post is regarding Linear Regression with one Variable.


No comments:

Post a Comment