A 30-Day Moving Average Beat LightGBM: It Catches 41% of Lima's Incidents in 5% of Cells
The best next-day forecast of incidents in Lima came from a 30-day moving average: the 5% of cells with the highest prediction contained 41.2% of cases, 8.25 times more than random selection (the PAI@5% metric). LightGBM with calendar features scored a PAI of 5.60–5.84, and with urban features, 5.36–5.51. Roads and buildings slightly worsened the ranking. So before reaching for a complex model, benchmark a simple baseline first: it may turn out to be the ceiling.
AI-processed from Хабр: Машинное обучение; edited by Hamidun News
Any team building a forecast on tabular data sooner or later adds more features to the model and reaches for a more powerful boosting method. A Habr write-up shows how that can end. The author took open data on criminal incidents in Lima and checked whether city characteristics (businesses, buildings, roads) help predict where incidents will be recorded tomorrow. The winner was a plain formula: a weighted average of incidents over the last few weeks. If you select the 5% of the city's cells with the highest forecast, they contain 41.2% of tomorrow's cases. That is 8.25 times better than random selection, and this number is called PAI@5%. LightGBM with calendar and urban features scored only 5.4–5.8.
How the experiment was set up
The city is divided into 2,120 H3 hexagonal cells, each about 0.87 km². For each cell, the model estimates every day the probability that an incident will be recorded there. The input is the number of cases over the previous 28 days. The data comes from the public layer of Peru's Ministry of the Interior (SIDPOL): 117,050 cleaned records for 2026. After excluding domestic violence and points outside the grid, 71,715 incidents remained. Environmental features come from OpenStreetMap.
The metric is simple. Take the 106 cells, that is 5% of the grid, with the highest forecast, and calculate what share of the next day's incidents fell into them. Divide that share by 0.05, and you get PAI@5%. A value of 1 means random selection, and 8.25 means coverage 8.25 times higher. It does not mean "risk rose eightfold."
The task is hard. In 91.5% of cell-day pairs, there are no incidents. Yet 5% of cells account for 41% of all cases over a year. But the composition of the "hot" cells changes quickly: the overlap of the top 5% between adjacent days, based on actual data, is only 0.24 by the Jaccard index.
What came out on top
The winner is EWM-30. For each cell, it sums daily incidents, with the weight of an observation halving every 30 days, so recent cases matter more than old ones. There is nothing to train here; the result is only calibrated into a probability. EWM-30 has a PAI of 8.25 with a 95% confidence interval of 8.00–8.50 and coverage of 41.2%. Next come a version with a 7-day half-life (8.02), a fixed map (7.99), the earlier LightGBM (7.52), and day-of-week averages (7.42). The advantage over the fixed map is small, +0.26, but the interval of 0.14–0.37 does not include zero.
Boosting with calendar features (day of the week, holidays, salary payment days) scored a PAI of 5.60–5.84. The version with businesses, buildings, and roads scored 5.36–5.51. Urban features did not help and slightly worsened the ranking. EWM-30 won in all nine paired comparisons: three boosting versions across three random seeds, with confidence intervals lying to the left of zero everywhere.
The third version performed worst: boosting meant only to adjust the logit of EWM-30. The best run scored 5.87, the worst 0.007. Probability accuracy by the Brier metric fell from 0.055 to 0.47–0.82. The practical lesson: if you take a strong base estimate and try to refine it without tight control, you can lose both the ranking and the calibration.
Limitations
The author lists the weak points himself. The OSM snapshot is dated November 11, 2026, after the end of the test period (October 29), and the code does not check whether the urban features peek into the future. So the results for those features cannot be considered fully clean. Buildings and roads describe the environment but do not prove the causes of crime. OSM coverage of the city is uneven: an empty cell may be a park, a market, or simply an unmapped neighborhood.
The data also reflects crime, how often people contact the police, and recording practices. About 30% of reports have no coordinates. In addition, 511 cells have a hidden history, and for them the EWM-30 estimate cannot be recalculated.
The practical takeaway for developers and product managers: before investing in a complex model, benchmark a simple baseline on the same data and with the same metric. Compare against it using paired confidence intervals, not by eye. If the baseline is close to the ceiling of predictability, new features will only add the risk of data leakage and instability.
- Jul 26, 2026SIFT: A Self-Improving Document Classifier That Retrains Without a Human
- Nov 12, 2026DXC brought AI agents into banking and hospital IT: incident resolution times fell by 95%
- Nov 19, 2026Artificial Analysis Measures TTS Start Time: Latency Ranges From 76 ms to Nearly 1 Second
- Mar 11, 2026Rakuten Cuts Incident Resolution Time in Half With AI
Key Questions Answered
How the experiment was set up?
The city is divided into 2,120 H3 hexagonal cells, each about 0.87 km². For each cell, the model estimates every day the probability that an incident will be recorded there. The input is the number of cases over the previous 28 days. The data comes from the public layer of Peru's Ministry of the Interior (SIDPOL): 117,050 cleaned records for 2026. After excluding domestic violence and points outside the grid, 71,715 incidents remained. Environmental features come from OpenStreetMap. The metric is simple.
What came out on top?
The winner is EWM-30. For each cell, it sums daily incidents, with the weight of an observation halving every 30 days, so recent cases matter more than old ones. There is nothing to train here; the result is only calibrated into a probability. EWM-30 has a PAI of 8.25 with a 95% confidence interval of 8.00–8.50 and coverage of 41.2%. Next come a version with a 7-day half-life (8.02), a fixed map (7.99), the earlier LightGBM (7.52), and day-of-week averages (7.42).
What are the key details on Limitations?
The author lists the weak points himself. The OSM snapshot is dated November 11, 2026, after the end of the test period (October 29), and the code does not check whether the urban features peek into the future. So the results for those features cannot be considered fully clean. Buildings and roads describe the environment but do not prove the causes of crime. OSM coverage of the city is uneven: an empty cell may be a park, a market, or simply an unmapped neighborhood.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
Waitlist: free vibecoding intensive + AI digest
Leave your email to reserve a spot in the free 2-day intensive and get the AI stories that matter.