House Price Prediction with Multiple Variable in Machine Learning

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

Machine Learning Dataset

import pandas as pd
import numpy as np
import  matplotlib.pyplot as plt
from sklearn import  linear_model
mydf=pd.read_csv("D://scikit_data/home/homeprices.csv")
mydf.bedrooms=mydf.bedrooms.fillna(mydf.bedrooms.median())
print(mydf)
model=linear_model.LinearRegression()
# print(model)
model.fit(mydf.drop('price',axis='columns'),mydf.price)
print(model)
sq=int(input("Enter area: "))
bdr=int(input("Enter No of Bedrooms: "))
age=int(input("Enter age of Home(How old is Home) : "))
print("Prediciated Price",model.predict([[sq,bdr,age]]))
print(model.intercept_)
print(model.coef_)
price=221323.0018654043 + 112.06244194*sq+23388.88007794*bdr+-3231.71790863*age

print("Formula Price",price)

 

We work very hard to provide you quality material
Could you take 15 seconds and share your happy experience on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *