Skip to content
Tuesday, 1 September 2026 · LondonENع
Rayan Azhari.Sustainability · Energy · Carbon · Built EnvironmentOccasional detours into philosophy, religion or programming, wherever curiosity leads
Property, Buildings & Sustainable Real Estate

Article 13: Why I Used Linear Regression Over Random Forest on 6,000 Buildings: A Modelling Walkthrough

A series mining the PhD thesis London and UK Office Buildings: Investigating Energy Use and Landlord-Tenant Influences (Azhari, 2025). Random Forest and a simple linear regression finished in a statistical dead heat on electricity EUI, so interpretability tipped the decision to the simpler model.

Rayan AzhariChartered Environmentalist, MISEP · 11 min read
Aerial view of Canary Wharf office towers beside the River Thames under a cloudy sky, the title card for Article 13 on why linear regression was chosen over random forest on 6,000 buildings.

A series mining the PhD thesis "London and UK Office Buildings: Investigating Energy Use and Landlord-Tenant Influences" (Azhari, 2025).

Key takeaway. Four candidate models, 33 explanatory variables and 6,038 office buildings. Random Forest and a simple linear regression finished in a statistical dead heat on electricity EUI. Interpretability tipped the decision to the simpler model. The choice was not aesthetic.

Figure

The modelling pipeline: data split, cross-validation, four models compared

Data is split 80/20; the training set drives 20-fold V-fold cross-validation; four candidate models compete on electricity EUI.

  1. 1

    All data

    6,038 office SCUs, 33 variables

  2. 2

    Training (80%)

    20-fold V-fold cross-validation

  3. 3

    Test (20%)

    held out, used once for final validation

  4. 4

    Random Forest

    R-squared 0.18, RMSE 0.28

  5. 5

    Linear regression

    R-squared 0.18, RMSE 0.28

  6. 6

    MARS

    R-squared 0.16, RMSE 0.29

  7. 7

    LASSO

    R-squared 0.12, RMSE 0.31

Random Forest and linear regression tied on RMSE and R-squared. Interpretability tipped the decision to linear regression.

Source: Author's analysis; 3DStock / BEIS metered data, 6,038 Greater London office SCUs (2017)

A draw on the leaderboard

If you set up a clean machine learning pipeline on the Greater London office dataset, with 33 explanatory variables and electricity EUI as the target, four models present themselves as candidates. Linear regression. LASSO. MARS. Random Forest. Run them through twenty iterations of V-fold cross-validation and they finish in this order: Random Forest at RMSE 0.28 and R-squared 0.18; linear regression at RMSE 0.28 and R-squared 0.18; MARS at RMSE 0.29 and R-squared 0.16; LASSO at RMSE 0.31 and R-squared 0.12.

Two models in front by a hair, two trailing. The two in front are tied to two decimal places on both metrics. The standard errors on those metrics are tighter than the gap between them. There is no statistical preference between Random Forest and linear regression for this dataset.

The interesting question then becomes: why did the thesis choose linear regression for the reported analysis? The short answer is interpretability. The longer answer is what this article is about.

The candidate set, briefly

The thesis methodology chapter identified seven plausible algorithms in the literature for the task at hand: linear regression, MARS, decision trees, Random Forest, gradient boosting machines, support vector regression and neural networks. Four were shortlisted for the empirical bake-off.

Linear regression is the baseline and the most interpretable of the family. Coefficients can be read, signed and challenged. It is also the most assumption-heavy: linearity (after log10 transformation of skewed variables) and independence of errors are required, and the model cannot capture non-linear interactions without explicit construction.

LASSO adds a penalty term that drives some coefficients to zero, selecting variables and stabilising estimates when predictors are correlated. It is interpretable in the same way as linear regression, with the added information that the dropped variables tell you something about importance.

MARS captures non-linearities and interactions by constructing piecewise linear basis functions. It is more flexible than linear regression and can match it on accuracy in many tabular problems. Its outputs are still more interpretable than tree ensembles, though less than a plain linear model.

Random Forest is an ensemble of decision trees that is generally the most flexible of the four on tabular data. It can capture non-linear effects, interactions and threshold behaviour without explicit construction. Its predictions are hard to interpret directly. Feature-importance scores and partial-dependence plots give partial views but no causal interpretation.

The other three (gradient boosting, SVR, neural networks) were left out because the size of the dataset and the moderate dimensionality of the feature space do not justify the additional complexity, and because the four shortlisted models already span the relevant interpretability range.

The pipeline

The work was done in R using the Tidymodels meta-package. The pipeline is conventional and worth describing because the choices generalise.

Feature engineering was specified per model using the Tidymodels Recipe framework. Linear regression and LASSO required dummy encoding of categorical variables, removal of zero-variance columns, imputation of missing values and decorrelation. Random Forest tolerated raw categoricals and required only imputation. MARS sat in between. Continuous variables with logarithmic distributions (floor area, energy meter counts) were log10-transformed.

The dataset was split 80 to 20 between training and test sets. The test set was held out and used only once at the end for final validation. The training set was used for hyperparameter tuning via twenty iterations of V-fold cross-validation.

Each model had a few hyperparameters specified or tuned. Random Forest: mtry = 1, trees = 1,000, min_n = 20. LASSO: alpha = 1, lambda = -0.1. MARS was run at its defaults. Linear regression has no hyperparameters in the usual sense.

The cross-validation produced twenty replicates of RMSE and R-squared for each model. The averages reported above are the means of those replicates. Standard errors are around 0.003 for RMSE and 0.014 for R-squared, so the daylight between the top two models and the bottom two is real, but the daylight between Random Forest and linear regression is not.

Why interpretability tipped the decision

When two models finish in a statistical dead heat, the choice between them is a methodological one. The thesis chose linear regression on three grounds.

The first is policy use. The thesis is partly a contribution to the operational rating policy conversation. Policymakers reading the work need to be able to interrogate the coefficients: which variables drive the prediction, in which direction, by how much. A Random Forest gives feature-importance scores and partial-dependence plots. These are useful but not interrogable in the same way.

The second is debate. Coefficients can be argued with. A reader who disagrees with the sign or magnitude of the height coefficient can engage with the argument. The same reader cannot engage with the equivalent claim from a Random Forest beyond saying the model thinks differently.

The third is generalisation. A linear regression is more honest about its assumptions and where they fail. A Random Forest can hide structural problems in its flexibility, fitting noise as enthusiastically as signal.

None of these is a knock-down argument. There are problems where Random Forest is the right choice: large feature spaces, deeply non-linear interactions, real-time prediction where interpretability is secondary, applications where the model output is acted on automatically. For the office stock-level prediction task in this thesis, none of those conditions held.

Why the gas R-squared is the more interesting number

A footnote that deserves more attention than it usually gets. The gas EUI R-squared sits at around 0.03 to 0.04 across all four models. That is not a flaw in any model. It is a feature of the data.

Gas use in offices is dominated by heating, and heating depends primarily on plant type, plant control, occupancy schedule and weather. Of those four, the 3DStock dataset captures only a coarse proxy for plant type (via EPC primary heating fuel) and nothing useful for the other three. With those features missing, no algorithm can predict gas EUI well.

This is the kind of finding that the interpretability of linear regression makes possible. A black-box model that returned R-squared 0.04 would invite a search for a better black box. The linear model returns 0.04 and tells you exactly which variables are signed and significant, which lets you conclude that the problem is the feature set rather than the algorithm.

What this says about modelling building energy

The 18 per cent ceiling on electricity EUI prediction is the central empirical finding of this thesis, and it has implications well beyond the office sector.

If you want to predict operational energy use from a building static and administrative attributes, your model will tap out at a relatively low R-squared no matter what algorithm you choose. The ceiling reflects the feature set, not the algorithm.

If you want to push past the ceiling, you need richer features: operating hours, plant efficiency, occupant density, BMS set-points, sub-metered demand. The 4DStock proposal discussed in Article 3 sketches one route. Operational rating schemes such as NABERS-UK (Article 9) sketch another.

If you accept that the ceiling is where it is, the policy implication is that schemes built on static building attributes alone (such as the EPC) cannot do the operational job they are sometimes asked to do.

That is the modelling result of this thesis stated as plainly as it can be put. The longer version is in Chapter 4 of the thesis itself.

What the data does not see

Only four of the seven candidate algorithms were fully tuned and evaluated. Gradient boosting, SVR and neural networks were considered but not benchmarked. Hyperparameter search was bounded by available compute. A wider grid or Bayesian optimisation could shift the metrics. The 80/20 split is a single realisation. Repeated splits with different seeds would tighten the standard errors on RMSE and R-squared. All regression methods used are linear after log10 transformation. Non-linear effects within categorical groups will not be captured by linear regression and may explain the small lead of Random Forest in some metrics. The R-squared ceiling reflects the feature set, not the algorithms. A different model with the same 33 variables will not break through without richer features. Code and data are subject to BEIS and BBP data-sharing agreements, which constrains full reproducibility.

This article closes the series. Across thirteen pieces, the argument has tracked from the empirical canvas (Articles 1, 4, 5) through the limits of physical-attribute models (Articles 2, 3), through the organisational dimension (Articles 6, 7, 8), through the policy implications (Articles 9, 10) and out via the extrapolation and hybrid-work questions (Articles 11, 12) to this technical coda. The throughline is the same in every piece. A building physical attributes explain a minority of how much energy it uses. The rest is operations, management, leases and policy. That is where the controllable savings sit, and that is where the next decade of office decarbonisation has to do its work.

Limitations

Only four of the seven candidate algorithms were fully tuned and evaluated. Gradient boosting, SVR and neural networks were considered but not benchmarked. Hyperparameter search was bounded by available compute; a wider grid or Bayesian optimisation could shift the metrics. The 80/20 split is a single realisation. Repeated splits with different seeds would tighten the standard errors on RMSE and R-squared. All regression methods used are linear after log10 transformation. Non-linear effects within categorical groups will not be captured by linear regression and may explain the small lead of Random Forest in some metrics. The R-squared ceiling reflects the feature set, not the algorithms. A different model with the same 33 variables will not break through without richer features. Code and data are subject to BEIS and BBP data-sharing agreements, which constrains full reproducibility.

References

About this series

This article is part of a fifteen-piece series adapting the 2025 PhD thesis "London and UK Office Buildings: Investigating Energy Use and Landlord-Tenant Influences" (Azhari, 2025) for a mixed academic and industry readership. The empirical findings draw on the 3DStock model of 6,038 office Self-Contained Units in Greater London with metered energy data for 2017, supplied by BEIS under a data-sharing agreement, alongside the Better Buildings Partnership Real Estate Environmental Benchmark. The qualitative findings draw on semi-structured interviews with seven major UK property organisations, conducted during the 2021 lockdown. Interviewees and their organisations are anonymised by role and organisation type. Please cite the original thesis for academic use.

Author. Rayan Azhari completed his PhD at the UCL Bartlett School of Environment, Energy and Resources in 2025, supervised by Paul Ruyssevelt and Kathryn Janda. The research was supported by the EPSRC Centre for Doctoral Training in Energy Demand (LoLo) and UK Research and Innovation through the Centre for Research into Energy Demand Solutions.

Other articles in the series. Article 1 The 30/85/89 Problem; Article 2 Why EPCs Do Not Tell You How Much Energy a Building Uses; Article 3 Eighteen Per Cent; Article 4 Mapping the Stock; Article 5 Height, Age and the Fuel Question; Article 6 The Split-Incentive Problem; Article 7 Green Leases and Service Charges; Article 8 From 38 to 73 Per Cent Energy Savings; Article 9 NABERS for Britain; Article 10 Time to Retire ECG-19; Article 11 Can London Speak for England and Wales; Article 12 The Hybrid-Work Footprint; Article 13 Why I Used Linear Regression Over Random Forest; Article 14 Vertical Postcodes; Article 15 What Is a Building?

Further reading

Office energy, part 13 of 15

Related posts

Article 12: The Hybrid-Work Footprint: What COVID-19 Did to Office Energy

A series mining the PhD thesis on London and UK office buildings (Azhari, 2025). Key takeaway. Hybrid work did not deliver the linear energy saving the headlines implied: some demand shrinks when occupancy drops, base-building load holds steady, and fresh-air ventilation actually grows.

· 8 min

Essays in your inbox

New writing on Syria, sustainability and finance, a few times a month.

Unsubscribe anytime. Read by 4,200+ professionals.