Should the foundation model replace the traditional way, or complement it, or be used together?

I use Geographically Weighted Regression (GWR) in ArcGIS a lot. It fits a small weighted model around each location, so each location gets its own coefficients. A map of those coefficients often tells me more than the prediction does.

Then the foundation models for tables and time series arrived. You give one a table of rows with known answers. It predicts the answer for new rows in one pass, with no training. So I had a plain question: do I replace GWR with a foundation model, do I keep GWR and add the model, or do I use the two together?

I tested it. The short answer is "together". The rest of this post shows why. The code and the saved results are public at github.com/mraad/geo-fm.

The two ways

The traditional way is the set of spatial statistics tools in ArcGIS: GWR, Forest-based and Gradient Boosted regression, kriging, and Emerging Hot Spot Analysis. Each tool has a model of space built in.

The foundation model has no model of space. It is trained one time, on a very large number of tasks. After that, your data is only context.

A classic model trains on one dataset. A foundation model trains one time and then reads your data as context.

To give the foundation model some geography, I did the simplest thing first. I added x and y as two more columns.

How I compared them

A comparison is only useful if it is fair. I used these rules:

  • The foundation model and the ArcGIS tool get the same training rows.
  • They predict the same test rows.
  • The test rows are full regions of the map, not random points. A random split puts a test point adjacent to its training points, and that makes each method look better than it is.
  • I report the cases where the traditional way wins.

Four maps. Each map divides one dataset into a south band, a middle band and a north band.

Each color is a region that I held out as one group. To test the north of California, the methods see house values from the middle and the south only.

The procedure for one dataset is short:

  1. Divide the map into regions.
  2. Hide the answers of one region.
  3. Give each method the other regions.
  4. Collect the predictions for the hidden region.
  5. Compare the predictions with the hidden answers.
  6. Do steps 2 to 5 again for each region.

The case for "replace"

For prediction at locations the model did not see, the foundation model usually wins.

TabICLv2 has open weights. With no training and no bandwidth search, it had a lower error than ArcGIS GWR on 6 of 7 real datasets.

Change in prediction error against ArcGIS GWR on seven real datasets. Left of the line is better than GWR.

Later I froze one rule with a TabDPT model and tested it on four datasets that I had not used before: landslides in Ecuador, soil zinc along the Meuse, food inspections in Chicago, and house values in California. It had a lower error than ArcGIS GWR on all four. It won 18 of 20 folds. With large regions as the test, it won 11 of 12 regions. The south of California went to GWR.

Interpolation gave the same result. For water depth at North Sea wells drilled from 2010, a foundation model on x and y only had an error of 47.4 m. Kriging had 51.0 m.

If prediction error is all you need, this is a strong case for "replace".

The case for "complement"

Prediction error is not all I need. The traditional way still does three things better.

It explains. GWR gives a coefficient for each location. I can get the same thing from a foundation model: move one variable by a small step and measure how the prediction changes. On a grid with known coefficients, those slopes correlate 0.95 to 0.96 with the GWR coefficients. But GWR is nearer to the true values, and it runs in seconds.

Four maps of one coefficient: the true surface, GWR, one global foundation model, and one foundation model for each location.

The fourth map is an idea that failed. I ran a separate foundation model at each location, on its nearest rows. It was slow, and its coefficient map had much noise.

It knows counts. Tokyo deaths is the one real dataset where GWR won. The count depends mostly on the expected number of deaths. A Poisson GWR has that structure built in. When I asked the foundation model for a rate (deaths divided by expected deaths), most of the gap closed. GWR still won.

Its errors are less clustered. On California house values, TabDPT missed by $53,189 on average and GWR missed by $69,677. But the TabDPT errors are more clustered on the map. Where it is too low at one location, it is frequently too low at the adjacent locations too.

Two California maps of prediction error, one for GWR and one for TabDPT, with the same dollar scale.

Red is a prediction that was too low. Blue is a prediction that was too high. I tried to correct TabDPT with the errors of nearby training locations. That made the average error and the clustering worse, so I removed the correction.

The case for "together"

The best results in this project came from the two ways in one pipeline.

A local model and a foundation model, blended. For yes-or-no targets, I fit a local logistic model that gives nearby rows more weight. That is the traditional idea. Then I blend: 90% local estimate, 10% foundation model. If the local estimate is 30% and the foundation model says 50%, the result is 32%. TabDPT alone had a lower error than ArcGIS GWR on 37 of 40 dataset and seed pairs. With the blend, it was 40 of 40.

A forecast that feeds the traditional analysis. Emerging Hot Spot Analysis gives each location one of 17 categories, such as "new hot spot". It looks at the past only. I wrote the analysis again in NumPy and checked it against ArcGIS: the category is the same at all 528 locations in my test cases. Then a time-series foundation model forecasts the next 6 months for each Chicago police beat. I add the forecast to the data and run the same analysis. The result is a forecast of the hot spot category.

Accuracy of the forecast minus each baseline, for each of six crime types.

Against "nothing changes", the forecast is more accurate for all six crime types, by 0.12 on average. Against "same month last year", the gain is small: +0.039 ± 0.013. For assault and battery there is no gain, because those two crimes follow the calendar.

Outside data helps both. I added 24 public county columns, such as business mix and urban share. On the 2024 county vote, the error fell by about 20% for the foundation models and for ArcGIS Forest-based. GWR could not use that many columns, because it fits a full model at each location.

In each of these cases, the traditional tool is not only the reference. It is a part of the method.

My answer

  • Replace? Only for prediction, and only after you test it on your data. Count data is a known gap.
  • Complement? Yes. Keep GWR for coefficient maps and for count models. Keep a map of the errors adjacent to the error number.
  • Together? Yes, and this is where I got the best results. The foundation model predicts. The traditional method supplies the local structure, the analysis, and the check.

Three limits apply to all of this. The large datasets are a sample of 10,000 rows, so that GWR completes in a practical time. The hot spot result is for one city. Some weights, such as TabFM and TimesFM 3.0, are for non-commercial use only, so read the license of each model before you build on it. TabICLv2, Mitra, TimesFM 2.5 and Chronos-2 have open licenses and gave similar results.

I keep ArcGIS GWR as the reference in each new test. If a foundation model cannot beat it on held-out regions, I do not keep the model.

Code and results

The repository is public: github.com/mraad/geo-fm.

  • docs/introduction.md is the plain-language introduction.
  • docs/overview.md is the technical overview with all results.
  • results/ has one report for each experiment. Each report gives the datasets, the seeds and the model versions.
  • geofm/ehsa.py is the Emerging Hot Spot Analysis in NumPy.
  • geofm/gwfm.py has the local coefficients from slopes.
  • docs/datasets.md gives the source and the license of each dataset.

One limit: the GWR benchmarks import a GPU GWR library of mine that is not public yet. You can read the code and the saved predictions now. You cannot run all the benchmarks yet.

Comments

Popular posts from this blog

How to use Esri Flex API on Android and iPhone

Augmented Reality, iPhone and ArcGIS Server

Image Flare Symbol For Clustered Graphics