
Calgary housing neural network
A neural network written from scratch in NumPy that prices Calgary homes.
2026Technical report in progressR² 0.986 (log)
What it is
A property-price model trained on the City of Calgary's open assessment data, with every layer, loss, and optimizer written by hand in NumPy. No PyTorch, no Keras.
Built with Danny Wang.
A real prediction from the trained model, run locally through the repo's Flask app.
How the model improved, run by run
Test-set R². Bars are in dollars; dots are in log space. From the repo's README.
How it works
- An 86 → 256 → 128 → 64 → 1 multilayer perceptron with ReLU and a linear output, 63,489 parameters in all.
- Inputs: four numeric features (year built, property type, log land size, community average), plus one-hot property use and multi-hot zoning codes.
- Huber loss (δ = 0.1) in log₁₀ dollars, Adam with the learning rate halved every 30 epochs, He initialization, batch size 512, 120 epochs.
- The output bias starts at the mean log-price, so the network only has to learn deviations from it.
Stack
- Python
- NumPy
- Pandas
- Flask
Results
- R² of 0.986 in log space on held-out data, with a median absolute percentage error of about 6%.
- With the 1,000 most expensive properties excluded: R² 0.87 in dollars and about $66k mean absolute error.
