NYC Data Science Academy| Blog
Bootcamps
Lifetime Job Support Available Financing Available
Bootcamps
Data Science with Machine Learning Flagship ๐Ÿ† Data Analytics Bootcamp Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lesson
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories Testimonials Alumni Directory Alumni Exclusive Study Program
Courses
View Bundled Courses
Financing Available
Bootcamp Prep Popular ๐Ÿ”ฅ Data Science Mastery Data Science Launchpad with Python View AI Courses Generative AI for Everyone New ๐ŸŽ‰ Generative AI for Finance New ๐ŸŽ‰ Generative AI for Marketing New ๐ŸŽ‰
Bundle Up
Learn More and Save More
Combination of data science courses.
View Data Science Courses
Beginner
Introductory Python
Intermediate
Data Science Python: Data Analysis and Visualization Popular ๐Ÿ”ฅ Data Science R: Data Analysis and Visualization
Advanced
Data Science Python: Machine Learning Popular ๐Ÿ”ฅ Data Science R: Machine Learning Designing and Implementing Production MLOps New ๐ŸŽ‰ Natural Language Processing for Production (NLP) New ๐ŸŽ‰
Find Inspiration
Get Course Recommendation Must Try ๐Ÿ’Ž An Ultimate Guide to Become a Data Scientist
For Companies
For Companies
Corporate Offerings Hiring Partners Candidate Portfolio Hire Our Graduates
Students Work
Students Work
All Posts Capstone Data Visualization Machine Learning Python Projects R Projects
Tutorials
About
About
About Us Accreditation Contact Us Join Us FAQ Webinars Subscription An Ultimate Guide to
Become a Data Scientist
    Login
NYC Data Science Acedemy
Bootcamps
Courses
Students Work
About
Bootcamps
Bootcamps
Data Science with Machine Learning Flagship
Data Analytics Bootcamp
Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lessons
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook
Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories
Testimonials
Alumni Directory
Alumni Exclusive Study Program
Courses
Bundles
financing available
View All Bundles
Bootcamp Prep
Data Science Mastery
Data Science Launchpad with Python NEW!
View AI Courses
Generative AI for Everyone
Generative AI for Finance
Generative AI for Marketing
View Data Science Courses
View All Professional Development Courses
Beginner
Introductory Python
Intermediate
Python: Data Analysis and Visualization
R: Data Analysis and Visualization
Advanced
Python: Machine Learning
R: Machine Learning
Designing and Implementing Production MLOps
Natural Language Processing for Production (NLP)
For Companies
Corporate Offerings
Hiring Partners
Candidate Portfolio
Hire Our Graduates
Students Work
All Posts
Capstone
Data Visualization
Machine Learning
Python Projects
R Projects
About
Accreditation
About Us
Contact Us
Join Us
FAQ
Webinars
Subscription
An Ultimate Guide to Become a Data Scientist
Tutorials
Data Analytics
  • Learn Pandas
  • Learn NumPy
  • Learn SciPy
  • Learn Matplotlib
Machine Learning
  • Boosting
  • Random Forest
  • Linear Regression
  • Decision Tree
  • PCA
Interview by Companies
  • JPMC
  • Google
  • Facebook
Artificial Intelligence
  • Learn Generative AI
  • Learn ChatGPT-3.5
  • Learn ChatGPT-4
  • Learn Google Bard
Coding
  • Learn Python
  • Learn SQL
  • Learn MySQL
  • Learn NoSQL
  • Learn PySpark
  • Learn PyTorch
Interview Questions
  • Python Hard
  • R Easy
  • R Hard
  • SQL Easy
  • SQL Hard
  • Python Easy
Data Science Blog > Machine Learning > Building a home-valuation algorithm: creating a model

Building a home-valuation algorithm: creating a model

Doug Devens, Devin Fagan, Jingrou Wei and Catherine Tang
Posted on Jun 7, 2020
The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

By Jingrou Wei, Catherine Tang Sin Kim, Devin Fagan and Doug Devens

Introduction

Buying a house is one of the largest financial decisions many people make in their lifetimes.  Homeownership has been encouraged for years by society and, by extension, governments.  However, when facing a decision of such financial magnitude, people may be concerned that they are paying more for the house than itโ€™s worth. 

Previously the complexity of this task led people to simply take the price of the house and divide by the total square feet, obtaining a price per square foot which one could compare to other houses in the neighborhood.  Now with the digitization of data and increased computational power, we are able to increase the sophistication of our analysis of the relative worth of a houseโ€™s features. 

Moreover, there are websites that allow one to compare other properties against the intended purchase. However, because the algorithms arenโ€™t public and the house one is buying is necessarily not the same as the ones on the website (because of location, timing and other factors), it is still necessary to extrapolate to the house actually being purchased.  This project created a model to make the process more transparent.

Using the Model

One could use a model such as we have developed to predict the price for which a specific house will sell.  However, there are many unquantifiable factors in a houseโ€™s final sale price, including emotional and macroeconomic factors.  Therefore, our target audience is the homeowner considering upgrading their house for an upcoming sale provide purchases a relative comparator between houses even if they have different features. 

We propose to develop a model that can quantify the potential increase in value (within prediction error) for a given upgrade for the house.  This is not to say the homeowner should or should not spend more for an upgrade if it has specific desirable features, but this can guide the amount the homeowner might, on average, expect to recoup from the investment.

Background

The dataset under analysis was the House Prices: Advanced Regression Techniques set on Kaggle.com.  The location of the houses sold was in Ames, Iowa during the period 2006 to 2010.  There were 1460 houses and their sale prices for which 79 features (e.g. the number of bathrooms, square footage, overall quality rating)  were quantified though something like the Multiple Listing Service..  The competition was to predict the prices of another set of houses for which the prices were not provided.

Data preprocessing and feature engineering

We first examined the dataset to determine the number of missing observations, meaning where a value for a specific feature for a house was missing.  We found relatively few of those, except for features such as pools and fireplaces.  Pools are relatively rare in the Upper Midwest, so that is expected.  Similarly, fireplaces are rarer in new houses that are built with modern heating systems. 

Next we took the quality characteristics that ranged from excellent to poor, such as overall quality and exterior quality, or livable to unfinished basement condition. We converted those to ranked continuous numbers on a range of one for poor to 10 for excellent.    We then squared these numbers, as we observed a quadratic relationship between the house sale price and the ordinal rankings in most cases, as shown in the figure below. 

Similarly, we modeled the log of the sale price, since as the price increased, the variation between two seemingly similar houses varied more, as we might expect ($5000 means more at a price of $160,000 vs $500,000.)  Taking the logarithm of a number reduces the relative importance of that variation at higher numbers.

Removing Features

We then removed features that correlated strongly with each other (not necessarily with the target house sale price), as shown in the figure below, where darker colors correspond to more correlation between variables.

 That there would be a correlation between some variables is not surprising.  For example, the square footage of the garage should generally vary directly with the number of cars, as we confirmed. We also examined the correlation between categorical features of the house (e.g. neighborhood and the year the house was built) and removed variables where we saw that the categorical explained more than 50% of the variation in the continuous variables. 

Finally, we also removed the feature โ€˜overall qualityโ€™ in favor of keeping the quality of specific features, such as the exterior finish, kitchen or basement.  Finally, we scaled the features so that they varied uniformly between 0 and 1, to remove artifactual removal of features in the model.

Model fit and selection

We examined two types of models, multiple linear regression models and tree-based models.  The underlying data are, to some extent, fundamentally linear as alluded to in the introduction, where a potential buyer would divide the house price by the square footage.  The linear models we used were penalized multiple regression models, using lasso and ridge penalizations.

We also examined a support vector regression using a linear kernel.  We also examined using a decision tree, a random forest decision tree model and a gradient boost decision tree model.  Tree models have an intrinsic ability to model a non-linear response because they make no assumptions about the nature of the response (sale price in this case.) One advantage of the linear models is that it is more intuitive for extracting information about a particular change to a feature, though one can obtain information about the relative importance of various features from a tree-based model.

In all the models we examined, we found that roughly the same features were important, an example of which we show below.  The exact ordering varied from model to model but the trends were confirmed and an example is shown below from the gradient boost tree.

We found that the linear models were somewhat prone to โ€˜over-fitting,โ€™ where the model fits itself to random noise that is in the training data set.  This shows up as a lower score in the test set.  Hyperparameter tuning can address this, but we were unable to find settings that reduced this over-fitting to zero.  The support vector regression model had less overfitting, with a more similar performance between the training and test datasets, as shown in the figure below.

Tree-based models

The tree-based models had more overfit with comparable test set performance as the support vector regression. The overfit of the tree-based models led to some concern about a decrease in performance in another set of unseen data. Because of this and the ability to extract specific information about changes to particular features, the team decided to select the support vector regression predictions for the submission.

Specific predictions from our model

As we recall, our goal was to predict the sale price of the houses, but that was of secondary importance to the goal of examining the relative importance of various features, such as the number of bathrooms or an improvement in kitchen quality.  As we described previously, we modeled the logarithm of the house sale. To obtain the price. we raise the prediction Y as an exponent of e. 

Sale Price

SalePrice = eYmodel

Similarly, if we use our model to predict a change in the potential sale price due to a change in a feature we will predict now Y + ฮ”Y, and the sale price can be obtained by:

SalePrice = eYmodel+ฮ”Ymodel = eYmodeleฮ”Ymodel,

The addition of a logarithm is multiplicative, so we must assume a base-case sale price (eYmodel) since any change is multiplied from that base, which we assume to be the median-value house of $163,000.  We then subtract the base-case price from that product and obtain the increase due to the upgrade  Using that as the transformation of our predictions to specific examples, we obtain the following:

  • Adding 150 sq ft of garage space, such as  a shed addition, approximately increases sale price by $4,000
  • Adding 200 sq ft of finished basement space (from unfinished) approximately increases sale price by $1,500
  • Improving Kitchen Quality from Fair to Good approximately increases sale price by $8,300
  • Adding a Full Bathroom approximately increases sale price by $11,300
  • Adding 500 sq ft of living space, such as by finishing an attic, approximately increases sale price by $7,500

These numbers can be expected to be different for houses with different base valuations. 

The homeowner now has a model that can provide a specific estimate of the value increase due to an upgrade, and which may serve as a budget if the upgrade is purely for sale of the house.

Github: https://github.com/devens-mn/Team_SD_House_Price_Model

About Authors

Doug Devens

Doug Devens has a background in chemical engineering, with a doctorate in rheology of polymers. He has nearly 20 years of experience in medical device product development, with a dozen product launches. It is here he learned the...
View all posts by Doug Devens >

Devin Fagan

Devin graduated from City College of NY with a Bachelor's degree in Political Science. His background includes exposure to economics, public policy, and campaign strategy. He plans to use data to create data-driven public policy that helps the...
View all posts by Devin Fagan >

Jingrou Wei

View all posts by Jingrou Wei >

Catherine Tang

View all posts by Catherine Tang >

Leave a Comment

No comments found.

View Posts by Categories

All Posts 2399 posts
AI 7 posts
AI Agent 2 posts
AI-based hotel recommendation 1 posts
AIForGood 1 posts
Alumni 60 posts
Animated Maps 1 posts
APIs 41 posts
Artificial Intelligence 2 posts
Artificial Intelligence 2 posts
AWS 13 posts
Banking 1 posts
Big Data 50 posts
Branch Analysis 1 posts
Capstone 206 posts
Career Education 7 posts
CLIP 1 posts
Community 72 posts
Congestion Zone 1 posts
Content Recommendation 1 posts
Cosine SImilarity 1 posts
Data Analysis 5 posts
Data Engineering 1 posts
Data Engineering 3 posts
Data Science 7 posts
Data Science News and Sharing 73 posts
Data Visualization 324 posts
Events 5 posts
Featured 37 posts
Function calling 1 posts
FutureTech 1 posts
Generative AI 5 posts
Hadoop 13 posts
Image Classification 1 posts
Innovation 2 posts
Kmeans Cluster 1 posts
LLM 6 posts
Machine Learning 364 posts
Marketing 1 posts
Meetup 144 posts
MLOPs 1 posts
Model Deployment 1 posts
Nagamas69 1 posts
NLP 1 posts
OpenAI 5 posts
OpenNYC Data 1 posts
pySpark 1 posts
Python 16 posts
Python 458 posts
Python data analysis 4 posts
Python Shiny 2 posts
R 404 posts
R Data Analysis 1 posts
R Shiny 560 posts
R Visualization 445 posts
RAG 1 posts
RoBERTa 1 posts
semantic rearch 2 posts
Spark 17 posts
SQL 1 posts
Streamlit 2 posts
Student Works 1687 posts
Tableau 12 posts
TensorFlow 3 posts
Traffic 1 posts
User Preference Modeling 1 posts
Vector database 2 posts
Web Scraping 483 posts
wukong138 1 posts

Our Recent Popular Posts

AI 4 AI: ChatGPT Unifies My Blog Posts
by Vinod Chugani
Dec 18, 2022
Meet Your Machine Learning Mentors: Kyle Gallatin
by Vivian Zhang
Nov 4, 2020
NICU Admissions and CCHD: Predicting Based on Data Analysis
by Paul Lee, Aron Berke, Bee Kim, Bettina Meier and Ira Villar
Jan 7, 2020

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day ChatGPT citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay football gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income industry Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI

NYC Data Science Academy

NYC Data Science Academy teaches data science, trains companies and their employees to better profit from data, excels at big data project consulting, and connects trained Data Scientists to our industry.

NYC Data Science Academy is licensed by New York State Education Department.

Get detailed curriculum information about our
amazing bootcamp!

Please enter a valid email address
Sign up completed. Thank you!

Offerings

  • HOME
  • DATA SCIENCE BOOTCAMP
  • ONLINE DATA SCIENCE BOOTCAMP
  • Professional Development Courses
  • CORPORATE OFFERINGS
  • HIRING PARTNERS
  • About

  • About Us
  • Alumni
  • Blog
  • FAQ
  • Contact Us
  • Refund Policy
  • Join Us
  • SOCIAL MEDIA

    ยฉ 2025 NYC Data Science Academy
    All rights reserved. | Site Map
    Privacy Policy | Terms of Service
    Bootcamp Application