House Price Prediction Documentation
This Repository contains the source code for Predicting House Prices using Linear Regression Algorithm(Supervised Learning).
Introduction:
Accurately estimating the value of real estate is an important problem for many stakeholders including house owners, house buyers, agents, creditors, and investors. It is also a difficult one. Though it is common knowledge that factors such as the size, number of rooms and location affect the price, there are many other things at play. Additionally, prices are sensitive to changes in market demand and the peculiarities of each situation, such as when a property needs to be urgently sold. The sales price of a property can be predicted in various ways, but is often based on regression techniques. All regression techniques essentially involve one or more predictor variables as input and a single target variable as output.
Tool Prerequisites:
- Pandas
- Matplotlib
- Scikit-Learn (Linear regression)
Linear Regression:
Linear regression is a linear approach for modelling the relationship between a Dependant variable(Output) and an Independant variable(Input). Different techniques can be used to prepare or train the linear regression equation from data, the most common of which is called Ordinary Least Squares.
Steps to create the Model:
- Import the required libraries and modules,
import pandas as pd
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
- Create a dataframe of the given dataset using Pandas.
- Define Inputs(Independant variables) and Outputs(Dependant variables) as
x
andy
. - Use the
LinearRegression()
function in the variablemodel
and Fit the data using themodel.fit()
function. - Find the predicted values using the
model.predict()
function and assign it toy_pred
.
Validation:
Validate the predicted values by taking a random value for prediction,
model.predict([[2500]])
Visualization:
Visualize the plot by using plt.plot()
function,
plt.ylabel("PRICE IN LAKH")
plt.xlabel("AREA IN SQFT")
plt.plot(x,y_pred)