Writing Machine learning & evaluation
The paper reported 0.59. I got 0.90.
Maloku & Maloku (2024) report a test R² of 0.5889 for linear regression on house prices, against 0.8229 for random forest. The gap is the paper’s point: the tree ensemble captures structure the linear model cannot.
I reproduced it on the same dataset and got 0.8997 for linear regression.
That is a swing of 0.31 on the model the paper uses as its weak baseline — large enough to invert the comparison the paper is built around. Working out where it came from turned out to be more interesting than the number.
What both of us ran
The dataset is the Kaggle House Prices: Advanced Regression Techniques set, 1,460 residential sales with 79 explanatory features. The paper evaluates linear regression and random forest; I added a decision tree and a small MLP for context.
| Model | Paper test R² | Mine | Difference |
|---|---|---|---|
| Linear Regression | 0.5889 | 0.8997 | +0.311 |
| Random Forest | 0.8229 | 0.8843 | +0.061 |
| Decision Tree | — | 0.8018 | — |
| Neural network (MLP) | — | 0.8720 | — |
Random forest moved a little. Linear regression moved enormously. A difference that affects one model five times more than another is not noise, and it is not the model — it is something about the data the model is seeing.
Three preprocessing differences
Reading the paper’s method section against mine, the pipelines differ in exactly three ways:
- The paper scales features with MinMaxScaler; I used StandardScaler.
- The paper drops
GarageYrBltandLotFrontagebefore training; I kept them. - The paper trains on raw sale price; I trained on log sale price and inverted the transform before scoring.
The first two are close to cosmetic for these models. Tree ensembles are invariant to monotone feature scaling, and linear regression with two fewer columns out of seventy-nine is not going to move 0.31.
The third one is the whole gap.
Why the log transform matters so much, and only to one model
Sale prices are right-skewed. Most houses cluster in a band and a thin tail runs to the expensive end. Linear regression fitted by least squares minimises squared error, so an observation ten times the median contributes a hundred times the penalty. The fit bends toward the tail, and everything in the dense middle — where nearly all the data lives — gets worse to accommodate it.
Taking logs makes the target roughly symmetric. Now a proportional error costs the same whether the house is worth 100,000 or 700,000, which is the assumption the model needed all along. It also converts the model’s additive structure into a multiplicative one on the original scale, which is closer to how house prices actually behave: an extra bathroom is worth a percentage, not a fixed number of dollars.
Random forests barely notice. They split on feature thresholds and predict a leaf average, so a monotone transform of the target changes the averaging slightly and nothing else. That asymmetry is the signature: a preprocessing step that moves one model class and not another is telling you which assumption it repaired.
Practical note: before concluding a linear model is too simple for your problem, check whether your target is skewed. A large share of “linear regression performed poorly” results are really “least squares was fitted to a heavy tail.”
The part where I stop congratulating myself
It would be easy to end here: the paper under-reported linear regression, my pipeline is better, 0.90 beats 0.82. That conclusion is wrong, and my own numbers say so.
On the single held-out split, linear regression takes the top spot at 0.8997 against random forest at 0.8843. Under five-fold cross-validation the ranking flips:
| Model | 5-fold CV R² | Std. dev. |
|---|---|---|
| Random Forest | 0.8726 | ±0.0095 |
| Linear Regression | 0.8479 | ±0.0645 |
| Neural network (MLP) | 0.8425 | ±0.0343 |
| Decision Tree | 0.7206 | ±0.0350 |
Random forest wins, and look at the spread: ±0.0095 against ±0.0645. The linear model’s performance varies nearly seven times more across folds. My single-split result of 0.8997 sits about eight tenths of a standard deviation above its own cross-validated mean — a good draw, not a better model.
So the paper’s conclusion survives. Random forest is the stronger model here. What does not survive is the specific number attached to the baseline, and a reader comparing 0.5889 to 0.8229 would overstate the gap by a factor of roughly five.
Two smaller things worth recording
The decision tree memorised the training set. Train R² of exactly 1.0000 against test 0.8018 — an unpruned tree with enough depth will always do this. Grid search over depth and leaf size moved test R² the wrong way, from 0.8018 to 0.7907. Tuning does not fix a model that is wrong about the problem.
Linear regression scored higher on test than on train — 0.8997 against 0.8601, a gap of −0.04. That reads as an error until you remember the variance above. With folds swinging ±0.065, a test split that happens to contain fewer hard cases than the training set will do exactly this. It is the same luck the cross-validation exposed, showing up in a second place.
What I would take from this
- A reported baseline number is a claim about a pipeline, not about a model class. Two people can run “linear regression” and differ by 0.31.
- If a preprocessing change moves one model family and not another, it repaired an assumption. Find out which one before deciding you improved anything.
- Report the spread. A single split gave me the opposite ranking to five folds, and only the folds carried the information needed to distrust it.
- Reproductions are worth doing even when the headline conclusion holds. The paper’s ordering was right and its baseline number was misleading, and those are different findings.
Notebook, results and figures are on GitHub.
References
- F. Maloku, B. Maloku. “House Price Prediction Using Machine Learning and Artificial Intelligence.” Journal of Artificial Intelligence & Cloud Computing, 3(4), 2024, pp. 1–10. The paper reproduced here.
- D. De Cock. “Ames, Iowa: Alternative to the Boston Housing Data as an End of Semester Regression Project.” Journal of Statistics Education, 19(3), 2011. The origin of the dataset used by both.
- G. E. P. Box, D. R. Cox. “An Analysis of Transformations.” Journal of the Royal Statistical Society, Series B, 26(2), 1964. Why transforming a skewed response is a modelling decision rather than a tidying step.
- T. Hastie, R. Tibshirani, J. Friedman. The Elements of Statistical Learning, 2nd ed. Springer, 2009. Model-assessment and cross-validation chapters.
- L. Breiman. “Random Forests.” Machine Learning, 45(1), 2001. Why ensembles are insensitive to monotone transforms of the inputs.
- X. Bouthillier, C. Laurent, P. Vincent. “Unreproducible Research is Reproducible.” ICML, 2019. On results that reproduce while their conclusions do not.