Prac - 8 (1) - Jupyter Notebook
Prac - 8 (1) - Jupyter Notebook
Write a python program to for house price prediction using linear regression
Out[45]: Avg.
Avg.
Area Avg. Area
Avg. Area Area Area
Number Number of Price Address
Income House Population
of Bedrooms
Age
Rooms
9127 Elizabeth
2 61287.067179 5.865890 8.512727 5.13 36882.159400 1.058988e+06 Stravenue\nDanieltown,
WI 06482...
USS Barnett\nFPO AP
3 63345.240046 7.188236 5.586729 3.26 34310.242831 1.260617e+06
44820
USNS Raymond\nFPO
4 59982.197226 5.040555 7.839388 4.23 26354.109472 6.309435e+05
AE 09386
In [16]: data.info()
<class 'pandas.core.frame.DataFrame'>
In [18]: data.describe()
In [20]: data.columns
Out[20]: Index(['Avg. Area Income', 'Avg. Area House Age', 'Avg. Area Number of Rooms',
dtype='object')
In [21]: sns.pairplot(data)
In [23]: sns.heatmap(data.corr(),annot=True)
In [32]: ml=LinearRegression()
ml.fit(X_train,y_train)
In [33]: print(ml.intercept_)
-2640159.796853739
In [41]: plt.scatter(y_test,predictions)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2619: FutureWar
ning: `distplot` is a deprecated function and will be removed in a future versi
on. Please adapt your code to use either `displot` (a figure-level function wit
h similar flexibility) or `histplot` (an axes-level function for histograms).
warnings.warn(msg, FutureWarning)
MAE: 82288.22251914928
MSE: 10460958907.208244
RMSE: 102278.82922290538
In [ ]: