A Deep Learning Model to Predict the Property Price

Machine LearningJul 2025By Tinotenda Linton

End-to-end TensorFlow/Keras workflow for residential property price prediction with robust preprocessing, feature engineering, and tuning.

PythonTensorFlowscikit-learnscikerasPandasNumPyMatplotlibMLP

A Deep Learning Model to Predict the Property Price

This project delivers an end-to-end deep learning workflow for predicting property prices from tabular realestate data.

Why this project

Real estate pricing is influenced by many nonlinear, interacting factors. Traditional linear models underfit these patterns. This project explores how a MultiLayer Perceptron (MLP) with careful regularization and feature engineering can outperform baselines.

Dataset & EDA

  • Typical features: location (city/latlon proxies), bedrooms, baths, lot size, floor area, year built, amenities, school/transport proximity, condition, renovation status.
  • EDA highlights: rightskewed price distribution, heterogeneous neighborhoods, multicollinearity between sizerelated features.
  • Actions: log transform for price, outlier clipping (IQR), standardization for numeric features, onehot encoding for categoricals.

Feature Engineering

  • Ratios: price_per_sqft, rooms_per_sqft
  • Temporal: property_age = listing_year year_built
  • Location: neighborhood bins, distance buckets
  • Interactions: e.g., bedrooms bathrooms, garage area

Modeling Approach

  • Baselines: Linear Regression, RandomForestRegressor, XGBoostRegressor
  • Deep Learning: MLP via TensorFlow/Keras (wrapped with scikeras for sklearnfriendly CV)
  • Tuning: randomized/grid search over layer sizes, dropout, L2, learning rate, batch size, patience

Example MLP skeleton (pseudocode)

from scikeras.wrappers import KerasRegressor
from tensorflow import keras as K

def build_model(n_features, units=256, layers=3, dropout=0.2, l2=1e-4, lr=1e-3):
    inputs = K.Input((n_features,))
    x = inputs
    for _ in range(layers):
        x = K.layers.Dense(units, activation="relu",
                           kernel_regularizer=K.regularizers.l2(l2))(x)
        x = K.layers.Dropout(dropout)(x)
    outputs = K.layers.Dense(1)(x)
    model = K.Model(inputs, outputs)
    model.compile(optimizer=K.optimizers.Adam(lr), loss="mae", metrics=["mse"])
    return model

Evaluation

  • Metrics: MAE, RMSE, R using 5fold CV + holdout validation
  • Diagnostics: learning curves, residual plots, feature importances (for tree baselines), permutation importance

Results (typical)

  • MLP with dropout + L2 regularization reduced MAE vs. linear baseline by 12-20%.
  • XGBoost remained competitive on some neighborhoods; ensemble of MLP + XGB improved stability.

Deployment Considerations

  • Persist preprocessing with sklearn ColumnTransformer + Pipeline
  • Model versioning (e.g., mlflow), prediction service (FastAPI), monitoring for drift, periodic retraining

Repository

GitHub: https://github.com/tinolinton/Housing