Skip to content
The estimator's result page: an estimated assessed value of $1,565,146

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.

.00.25.50.751.00baseline: R² 0.194 in dollars0.19baselineMSE, 200 epochsHuber + Adam: R² 0.724 in dollars0.72Huber + Adamnew encodingHuber + Adam: R² 0.986 in log spacetop 500 out: R² 0.765 in dollars0.77top 500 outpriciest removedtop 500 out: R² 0.987 in log spacetop 1,000 out: R² 0.867 in dollars0.87top 1,000 outpriciest removedtop 1,000 out: R² 0.987 in log spacelog space ≈ .99

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.
The estimator's input form
Year built, land size, community, and zoning go in.