Linear Regression With Multiple Variable
Linear Regression with Multiple Variable
Here we predict the house price by its area,bedroom & age.
first we import necessary library
Here you can see Nan value for bedroom so we have to fill something there . so we find the median of bedroom column and replace the Nan value with median. for fill the Nan value we use fillna method of pandas library
Here we pass the independent variable area,bedroom and age by using df.drop('price') which means all column except price and then we pass dependent variable in fit method which is price column.Fit method train our linear Regression model.
Lets predict the price of house. Here we predict the price of house which has a 3000 sqft area , 3 bedroom and 40 year old.
y = m1(coef_)+m2(coef_)+m3(coef_)+intercept where y is dependent variable
You can download csv file by click here
you can download the code by download my repository by click here
👍
ReplyDelete