Project 04 · Machine learning

Machine Learning Model · Airbnb in London

✅ publisheddata: 2025

Classification model applied to Airbnb listings in London using 2025 data. It estimates each property's relative tendency to fall among the higher or lower prices for its accommodation type, based on availability, reviews, stay conditions and location. The predictions allow comparisons of listing profiles and exploration of their geographical distribution.

Python
Pandas
Scikit-learn
Machine Learning
Airbnb
Logistic Regression

CONTEXT AND OBJECTIVE

This project aims to identify which characteristics distinguish relatively high- and low-priced Airbnb listings within each accommodation type in London. Comparing listings within each category establishes a consistent reference for entire apartments, private rooms and other accommodation types. The model examines how availability, recent activity and location are associated with these differences.

The analysis uses listings from Inside Airbnb for September 2025. Following quality checks, the dataset contains 44,019 London listings. Nightly prices define the reference bands for each segment, while listing characteristics provide the information used to classify them.

This information is used to train a probabilistic classifier that assigns each listing a score indicating its tendency towards higher prices. The score ranks properties according to their characteristics and enables examination of their distribution across London neighbourhoods. The model therefore provides a measure of relative positioning that complements the monetary price.

MODEL AND VALIDATION

DEFINING RELATIVE PRICE

The target variable is defined within each accommodation type using the 25th and 75th percentiles of nightly prices:

  • Low-priced: listings with prices at or below the 25th percentile of their accommodation type.
  • Central band: listings with prices between the 25th and 75th percentiles, held out for subsequent model application.
  • High-priced: listings with prices at or above the 75th percentile of their accommodation type.

Training uses the extremes. During subsequent application, the standard zone is defined by intermediate score values, with thresholds independent of the price percentiles.

CLASSIFYING THE PRICE EXTREMES
y_i=1\ \text{if}\ p_i\ge Q_{75}(t_i),\quad y_i=0\ \text{if}\ p_i\le Q_{25}(t_i)

p represents the nightly price and t the accommodation type. Q25 and Q75 are the percentiles calculated within that segment. Label 1 identifies the high-priced extreme and label 0 the low-priced extreme.

Selecting the extremes produces a sample of 22,454 listings for supervised learning, with similar representation of both classes. Evaluation holds out 20% of these records to test the model on properties other than those used for fitting.

VARIABLES AND TRAINING

The variables represent recent activity, commercial conditions and listing location. The selection brings together three groups of information:

  • Activity: annual availability, total reviews, reviews in the last twelve months, monthly frequency and time since the last review.
  • Conditions: minimum-night bands and the number of listings managed by the host.
  • Location: the property's neighbourhood, with ten neighbourhoods selected for their contrasting relative prices and the remainder grouped into a common category.

Preparation combines missing-value imputation, numerical variable scaling and categorical encoding. Neighbourhoods are selected exclusively using training data. A logistic regression is fitted to these variables, transforming their contributions into a probability between 0 and 1.

SCORE FOR THE TENDENCY TOWARDS HIGHER PRICES
P(y_i=1\mid X_i)=\sigma\left(\beta_0+\sum_{j=1}^{k}\beta_j x_{ij}\right)

Each x represents a property characteristic, beta denotes the learned weights and sigma is the sigmoid function that transforms this combination into a value between 0 and 1. The score is relative to the extreme classes used in training.

MODEL EVALUATION

Evaluation uses the area under the ROC curve to measure the model's ability to rank relatively high-priced listings against low-priced ones. It achieved 0.768 on the independent test set, indicating discrimination ability and room for improvement.

Probability error and calibration are also evaluated by comparing scores with the observed proportion of high-priced listings. These tests help interpret the result as a statistical signal and assess its stability outside the training set.

To aid interpretation, the score is divided into low-price, standard and high-price tendency zones using the 30th and 70th percentiles calculated during training. Comparing these zones with relative price references by accommodation type yields overall test agreement of approximately 49%. The segmentation provides guidance for exploring cases, with greater accuracy at the extremes than in the intermediate zone.

APPLICATION AND LEARNING

When the model was applied to the complete dataset, each listing received a score and an estimated zone. The results were mapped across London to identify clusters and contrasts between neighbourhoods.

The maps also distinguish zones that match the observed price references from those where the model is incorrect. This geographical perspective reveals segments that share availability, activity and location signals, as well as listings whose behaviour is harder to classify.

Location and activity signals help rank listings by their relative price tendency. The score enables comparisons of property profiles, while the three zones provide an indicative segmentation for exploring differences between room types and neighbourhoods.