Develop a python program that predicts the housing prices in various counties using linear regression.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#   Importing required packages
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
from sklearn.metrics import r2_score

#   This class contains various methods performing
#       - Reading data from file.
#       - Printing summary of the data
#       - Plotting data
#       - Fitting linear regression to predict house price of a county
class HousePriceLinearRegression:
    #   Default constructor of the class,
    #   it calls read_data method to get data from excel.
    def __init__(self):

    #   This method reads excel file, and stores the data in the instance variable.
    def read_data(self): = pd.read_excel("2019-MedianPricesofExistingDetachedHomesHistoricalData.xlsx",

    #   This method displays the summary of the data
    def print_summary(self):
            print("Data is not available")

    #   This method takes x, y, and predicted data as the required features,
    #   and plots the scatter plot and fitted line on the plot.
    def plot_data(self, x_data, y_data, pred, xlab="CA", ylab="Alameda"):
       plt.scatter(x_data, y_data...

By purchasing this solution you'll be able to access the following files:
Solution.xlsx, Solution.docx and

for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats