Downloads · 30 days
0
aurele1/nyc_airbnb_price1
nyc_airbnb_price1 is a machine learning model from aurele1. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Click here to watch my 4–6 minute project walkthrough
Downloads · 30 days
0
Access
Public
Updated Dec 9, 2025
Repo size
1.1 GB
Likes
0
Public
Click a slice to open those files.
.pkl1 GB · 90%
From the Hugging Face model README
Click here to watch my 4–6 minute project walkthrough
This repository contains the code and trained models for a data science project based on the New York Airbnb Bookings dataset (Kaggle).
The goal of the project is to:
This project uses the New York Airbnb Bookings dataset from Kaggle –
New York Airbnb Bookings (Kaggle).
The dataset contains 48,895 listings and 16 columns.
Each row represents an Airbnb listing in New York City, including the nightly price in USD, the main area of the city (neighbourhood_group), the specific neighbourhood name, and the room type (entire home/apartment, private room, or shared room).
Additional fields describe the listing’s activity and availability, such as minimum nights required, number of reviews, reviews per month, availability over 365 days, and the listing’s latitude and longitude coordinates.
The project includes both a regression and a classification task:
price: nightly price in USD (numeric).I started with brief descriptive statistics to understand the distribution and scale of the main variables.
As part of the initial exploration, the data was lightly cleaned: handling missing values (for example, filling reviews_per_month with 0 for listings with no reviews), converting date columns to datetime, filtering unrealistic outliers in price (very expensive listings above 1000 USD per night) and extreme values in minimum_nights (stays longer than 365 nights).
Text columns that are not useful for numeric modeling (such as name and host_name) were dropped to keep the feature space focused.
Below are some of the main visual insights from the exploratory analysis:


Price by room type:

Average price by neighbourhood group:

Price vs. number of reviews:


Overall, the EDA suggests that neighbourhood group and room type are the strongest drivers of price, with entire homes and listings in Manhattan being the most expensive on average.
In contrast, popularity measures such as the number of reviews show a much weaker and less linear relationship with price, indicating that they are not sufficient on their own to predict the nightly rate.
As a starting point, I trained a simple linear regression model to predict the nightly price using only the original numerical features (without feature engineering).
A scatter plot of true vs. predicted prices shows that the model systematically underestimates very expensive listings and overestimates cheap ones, which is consistent with the low R².
This baseline serves as a reference point for the later, more advanced models.

To improve the models, several new features were engineered:
reviews_per_year – computed from reviews_per_month to capture yearly popularity.neighbourhood_group, room_type, location_cluster) into numeric one-hot encoded features for modeling.In addition, a KMeans clustering step was applied on the geographical coordinates (latitude, longitude) to create a new location-based feature:
location_cluster – a cluster ID (5 clusters) that groups listings into spatial segments within the city.
location_cluster).After feature engineering, I trained three regression models on the enriched feature set:
All models were evaluated on a held-out test set using MAE, RMSE and R².
Compared to the baseline linear regression (R² ≈ 0.11), the models with feature engineering achieved a substantial improvement:
The Random Forest Regressor provides the best trade-off between bias and variance and clearly outperforms both the baseline and the other improved models.

The final winning regression model is a Random Forest Regressor with 200 trees and a fixed random seed for reproducibility.
On the test set it achieves approximately:
The model is trained on the full feature-engineered dataset and saved in this repository as:
winning_model.pkl – serialized Random Forest regressor for nightly price prediction.In addition to predicting the exact nightly price, the project also defines a classification task: predicting the price level of a listing (low / medium / high).
To create the classification labels, the continuous price variable is transformed into three classes using the 33rd and 66th percentiles of the training set only:
This quantile-based binning produces three roughly balanced classes, which is helpful for training classification models: in both the train and test sets each price class contains roughly one third of the samples (around 32–35% per class).
From a business perspective, the most important group is the high-price class (class 2), so recall and F1-score for this class are especially important: misclassifying a high-price listing as low/medium is more costly than mistakenly flagging a cheaper listing as “high-price”.
For the price-level classification task (low / medium / high), I trained three different models on the feature-engineered dataset:
All models were evaluated on the test set using accuracy, macro F1 and weighted F1, as well as confusion matrices to inspect the types of mistakes. Because the classes are reasonably balanced, accuracy is informative, but F1 scores are used to better compare performance across classes.
On the test set, the models achieved approximately:
The confusion matrices show that the medium-price class (class 1) is the most challenging and is often confused with both low and high prices. Among the three models, the Random Forest provides the best overall separation between classes and the strongest performance across all metrics.

The final chosen classification model is a Random Forest Classifier, which provides the best balance between accuracy and F1-score across the three price levels. In addition to the default model, a small GridSearchCV was run over a few combinations of hyperparameters (such as the number of trees and maximum depth) to slightly improve performance and check the robustness of the results. The tuned Random Forest classifier is saved in this repository as:
winning_classifier.pkl – serialized Random Forest classifier for predicting the price level (low / medium / high).data1.csv – dataset used in the notebookAnother_copy_of_Assignment_2_Classification,_Regression,_Clustering,_Evaluation.ipynb – full analysis (EDA, feature engineering, regression and classification)winning_model.pkl – best regression model (Random Forest)winning_classifier.pkl – best classification model (Random Forest)The models and notebook are also available on Hugging Face:
aurele1/nyc_airbnb_price1
This project explored Airbnb listings in New York City and built both regression and classification models to predict nightly prices. Feature engineering (especially location-based clustering, room type and neighbourhood information) significantly improved performance over a simple baseline. A Random Forest Regressor was selected as the final price prediction model, and a Random Forest Classifier as the final model for predicting price levels (low / medium / high). The full workflow — from EDA and preprocessing to modeling and evaluation — is documented in the accompanying notebook.
The project shows that: