Predicting House Prices (Linear Regression)

Machine Learning

I'm Bored as hell to explain this so ill just add the code , you just ask some AI bots to answer your questions

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
#Loading the data
data=pd.read_csv("/work/home_dataset.csv")

#Extracting the data
house_size=data['HouseSize'].values
house_price=data['HousePrice'].values


plt.scatter(house_size,house_price,marker="o",color="blue")
plt.title("Price Prediction")
plt.xlabel("Hourse Size")
plt.ylabel("House Price")
plt.show()

#Training part
x_train,x_test,y_train,y_test=train_test_split(house_size,house_price,test_size=0.2,random_state=42)
x_train=x_train.reshape(-1,1)
x_test=x_test.reshape(-1,1)

#Creating the model
model=LinearRegression()
model.fit(x_train,y_train)

#Freakin Predict this 
predict=model.predict(x_test)

#Evaluation
plt.scatter(house_size,house_price,marker="o",color="blue",label="Actual Prices")
plt.plot(x_test,predict,color="red",linewidth=2,label="predicted price")
plt.xlabel("house Size")
plt.ylabel("predicted Prices")
plt.legend()
plt.show()

Here's the Link for it