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:
| Column | Type | Description |
|---|---|---|
fastanumer | TEXT (PK) | Unique property identifier. |
base_price_real | INTEGER | The sum of L1, L2, and L3 model outputs in real ISK. |
cumulative_log | REAL | Used for Confidence Interval (CI) calculations. |
last_rmse | REAL | Used for Confidence Interval (CI) calculations. |
l1_contribution | INTEGER | Real ISK breakdown for the first model layer. |
l2_contribution | INTEGER | Real ISK breakdown for the second model layer. |
l3_contribution | INTEGER | Real ISK breakdown for the third model layer. |
postal_code | INTEGER | Used for HPI segment lookup. |
property_type | TEXT | Used for HPI segment lookup. |
computed_at | TIMESTAMP | Record 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:
- Lookup: The system executes
SELECT * FROM property_predictions WHERE fastanumer = ?. - 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).
- 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.
Related
- 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"]
}