Precomputed Property Predictions Table

Summary

The Precomputed Property Predictions Table is a performance optimization component within the Eidos inference engine. It stores pre-calculated outputs from the L1, L2, and L3 LightGBM models for approximately 121,000 Icelandic residential properties, reducing API latency from ~100ms to sub-millisecond database lookups.

Details

To optimize the performance of the predict and agent-impact endpoints, the system utilizes a precomputed lookup strategy. Previously, every request triggered the sequential execution of three LightGBM models. Because property features are largely deterministic, these calculations are now performed once during a batch process and stored in a specialized table, property_predictions.

Table Schema and Design

The table is indexed by fastanumer (the unique Icelandic property identifier) and includes the following fields:

ColumnTypeDescription
fastanumerTEXT (PK)Unique property identifier.
base_price_realINTEGERThe sum of L1, L2, and L3 model outputs in real ISK.
cumulative_logREALUsed for Confidence Interval (CI) calculations.
last_rmseREALUsed for Confidence Interval (CI) calculations.
l1_contributionINTEGERReal ISK breakdown for the first model layer.
l2_contributionINTEGERReal ISK breakdown for the second model layer.
l3_contributionINTEGERReal ISK breakdown for the third model layer.
postal_codeINTEGERUsed for HPI segment lookup.
property_typeTEXTUsed for HPI segment lookup.
computed_atTIMESTAMPRecord of when the prediction was generated.

Implementation and Workflow

The precomputation process involves loading unique properties from the kaupskrá (sales registry) and existing transaction records. Geocoding is handled via the iceaddr_lookup utility; in initial runs, the system achieved a 90% geocoding hit rate, providing coordinates for approximately 115,000 properties.

The inference logic follows a specific sequence:

  1. Lookup: The system executes SELECT * FROM property_predictions WHERE fastanumer = ?.
  2. Inflation: The “real” price stored in the table is inflated to a “nominal” price using the current House Price Index (HPI) based on the property’s segment (postal code and type).
  3. Agent Impact: For agent-specific requests, the nominal price is adjusted by the agent_spread.

Maintenance and Integration

The table is designed to be rebuilt automatically following every model retraining session. This trigger is wired into the layers.py main execution block, ensuring that predictions stay synchronized with the latest model weights.

Refactoring of inference.py and main.py ensures that the POST /api/predict and POST /api/agent-impact endpoints prioritize this table. The LightGBM models are now only invoked in real-time when a “presentation override” (such as a new listing with custom parameters) is requested, or for properties not found in the precomputed set.

  • Eidos
  • House Price Index (HPI)
  • fastanumer
  • iceaddr
  • Hermes Agent
  • LightGBM Model Layers
{
  "cluster_id": 260,
  "node_type": "Entity",
  "title": "Precomputed Property Predictions Table",
  "summary": "A performance optimization component that stores pre-calculated LightGBM model outputs for ~121,000 Icelandic residential properties, replacing real-time inference with sub-millisecond lookups.",
  "related": ["Eidos", "House Price Index (HPI)", "fastanumer", "iceaddr", "Hermes Agent", "LightGBM Model Layers"]
}