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 > Maximizing Home flipping profits using ML Techniques.

Maximizing Home flipping profits using ML Techniques.

Daniel Setiawan, Laurel He and username
Posted on Feb 5, 2023

See our app here

Home-flipping is becoming more and more popular as investors are finding unique ways to capitalize on their returns. As it turns out, however, 20% profit is considered the break-even point. As a result, over 28% of home-flippers end up losing money. In order to be successful at home-flipping, one must be able to conduct thorough research in order to make fiscally smart decisions. Throughout this blog, weโ€™ll be demonstrating various machine learning techniques that can help us make informed decisions about which properties to purchase and which improvements generate the highest return on investment (ROI).

Data Preprocessing

The analysis uses two different datasets: one provided by Professor Dean De Cock (Housing, Ames) and another by Kaggle (Real Estate, Ames). The first dataset is the primary dataset, which contains 2500 observations and 78 features. The homes span over 28 neighborhoods in Ames, IA in 2006-2010. The second dataset contains 22.5K observations and is used to geographically visualize where the homes are with respect to their coordinates.

Before any analysis could be done, the data must first be cleaned. Not all missing values are expected to be non-existent, so some work needed to be done to address those missing values. We started by identifying which features contained missing values.

NaN values relating to area (TotalBsmtSF, GarageArea, MasVnrArea) were addressed first and filled with 0. Then, features containing NaN relating to these groups were filled with 0 if its respective area were also 0. This was able to address a significant chunk of the NaN values in the dataset. Other categorical NaN values were filled with the most common value attributing to that feature. For continuous NaN, such as GarageYrBlt, the most common value is the YearBuilt.

Four new features were added to the dataset (Crime Rate, Public Schools, Neighborhood Appreciation, and Neighborhood Income). These features were taken from neighborhoodscout.com and added in respect to the geographical coordinates of the merged dataset. These features contain ordinal values ranging from 0 to 10.

Additionally, 2 features were engineered from existing features with the latter being dropped after:

  • HouseAge = YrSold โ€“ YearBuilt
  • LastRemod = YrSold โ€“ LastRemodAdd

 

Model Preprocessing

The preprocessing of the data varies between the type of model used.

For linear models, categorical features were separated into ordinal and nominal variants. Nominal variants were then dummified. To remove multicollinearity among the features, a correlation matrix was used to identify the correlation between two features. Features with high collinearity with each other were dealt with by selecting the more important feature of the two. 

Once all features had low correlation individually, a VIF was conducted to investigate each feature's correlation with all other features. A for loop was then conducted to slowly remove each feature and list VIFs until features had a VIF score of 10 or less. The final data was then scaled in respect to its mean and standard deviation using a Standard Scaler.

For SVR, tree-based models and our final stacked model, categorical features were separated into ordinal and nominal variants. Nominal variants were label encoded. Aside from Random Forest, the data was also scaled in respect to its mean and standard deviation using a Standard Scaler. 

For the time series analysis model, a DateSold feature was engineered from YrSold and MoSold. The first of each month was chosen (e.g: a home sold in February 2008 yielded the value 2008-02-01). The mean of each month was then chosen as the final datapoint for time series analysis.

 

The where & when.

A key driver to a successful home-flipping is timing. In order to maximize profits, itโ€™s necessary to know when to buy and sell a home. To achieve that, we first explore a broadened view of home purchase annual frequency.

 

 

When analyzing the chart above, itโ€™s clear that seasonality exists. As demand starts to pick up in the summer months, we can presume that higher prices will follow suit due to the lower supply. However, there are many caveats to that: for instance, inventory in the summer months could be significantly higher due to an influx of seasonal listings. This, coupled with warmer weathers, higher levels of tourism, and many other factors could mean that the high summer demand could meet an equally high seasonal supply.

Seasonality isnโ€™t the only factor to home prices. When analyzing how well a home fares within a community, itโ€™s important to also capture the overall trend. After all, the prices of homes may differ from one year to the next.

 

Decomposed Trend & Seasonality
 

To conduct proper analysis, we must first decompose the trend and seasonality from the data. In the graph above, the top-most plot represents the original prices of homes sold through time. The second graph represents the extracted trend and the third graph represents the extracted seasonality.

If we account for seasonality alone, then flippers should aim to buy in March and sell in January when prices are the lowest and highest, respectively. However, as itโ€™s unlikely that flippers can close a home purchase in a single month, itโ€™s more feasible to aim to buy a home in February โ€“ April and sell within June โ€“ August.

When inspecting the trend alone, we can see that the home prices contain a general downward direction. While subtle, the trend started to pick up and shift throughout 2009, which is the height of the Great Recession. However, weโ€™d be naive to think that every part of Ames follows a similar trend.

 

 

In fact, the prices in some neighborhoods remain stable throughout the recession, though some fared significantly better than others. Shown above, these neighborhoods had been given a trial by fire and had proven to be more resilient than others throughout the great recession. As the recession starts to ramp up during 2023, these neighborhoods are premium neighborhoods and should be given higher priority than others when looking to buy a home within Ames.

 

 

When adjusting for the seasonality and trend, we can then forecast the sale prices for the next few months following the recession. By doing so, this can give us a more defined perspective on the best time to buy and sell a home, which could help maximize the investment.

 

The what.

When determining what to look for in a home, we first tune into various models and its respective performance. Using Lasso Regression, we were able to reduce the features in the model to 35 while maintaining a fairly high test score (0.920). Non-linear models, such as Random Forest, Gradient Boost, and SVR were also used to rank model feature importances. Afterwards, we applied a stacked regression model to combine nonlinear models in order to extract the top feature importance based on multiple models.

In each model, the features were ranked according to their importance. In cases where the model doesnโ€™t have a feature importance method, such as penalized regression, the absolute value of the coefficients were used to rank the modelโ€™s importance. Once sorted in order, a for loop was conducted in order to reduce the number of features one by one and capture the number of features to the regression score.

 

Model Performance vs. Features

 

While each model behaves differently, itโ€™s shown above that the models start to plateau around 30 features, with most models able to capture the Sale Price of a home with about 10-15 features. In other words, 30+ predictors increased the complexity of the model while providing almost no additional value.

A summary of the models used and their results are captured below.

 

 

The how.

 

Using our final Stacked Model, the most important features are ranked as shown below.

 

In order to maximize profits, the features to select should be the ones with the highest importance relative to the stacked model. In other words, a successful home-flip should do the following:

 

  1. Focus on building structure. Choose single-story homes with potential to expand upwards in order to increase the GrLivArea. This will give the highest opportunity to maximize living area while keeping lot size small.
  2. Look for worn-down homes with good building material quality. Itโ€™s easier to touch up the OverallCond than the OverallQual. Therefore, aiming to buy worn-down great quality homes would ensure that youโ€™d be buying at a discount!
  3. While it may be difficult to increase TotalBsmtSF, the feature is moderately correlated with BsmtQual and BsmtCond. Therefore, using the same points as above, we can focus on finding homes with great basement quality in a worn down condition.
  4. While it may be helpful to look at the forecasted chart for the optimal buy/sell target, a general consensus would be to buy in February โ€“ March and sell in June โ€“ August.
  5. Aim to buy homes in neighborhoods that have been proven to have fared well against the last recession. These neighborhoods are more resilient than the other neighborhoods, and that should play a significant factor when choosing the next home.

 

Happy flipping!

 

About Authors

Daniel Setiawan

Hi, I'm Daniel! I currently work as an R&D Engineer at a startup in Berkeley, CA. In my role, I interface with various electronics (RF/DC) and code (Python) to analyze and improve product performance. Iโ€™m intrigued by science...
View all posts by Daniel Setiawan >

Laurel He

Hi, my name is Laurel He. My undergrad was in Geosystems Engineering and Hydrogeology at the University of Texas at Austin. I got my Masterโ€™s in Atmosphere and Energy, Civil Engineering at Stanford University. Iโ€™m passionate about nature,...
View all posts by Laurel He >

username

View all posts by username >

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