[go: up one dir, main page]

0% found this document useful (0 votes)
81 views1 page

Predicting House Prices Using Scikit-Learn

This project utilizes a Linear Regression model to forecast house prices based on features such as area, bedrooms, and age. The source code demonstrates how to load data, split it into training and testing sets, train the model, and evaluate its performance using Mean Squared Error. The implementation is carried out using the Scikit-Learn library in Python.

Uploaded by

zacklygammer567
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views1 page

Predicting House Prices Using Scikit-Learn

This project utilizes a Linear Regression model to forecast house prices based on features such as area, bedrooms, and age. The source code demonstrates how to load data, split it into training and testing sets, train the model, and evaluate its performance using Mean Squared Error. The implementation is carried out using the Scikit-Learn library in Python.

Uploaded by

zacklygammer567
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Predicting House Prices using Scikit-

Learn
Abstract

This project implements a Linear Regression model to predict house prices based on input
features.

Source Code

import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error

df = pd.read_csv("housing.csv")
X = df[["area", "bedrooms", "age"]]
y = df["price"]

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)


model = LinearRegression()
model.fit(X_train, y_train)
predictions = model.predict(X_test)

print("Mean Squared Error:", mean_squared_error(y_test, predictions))

You might also like