A map between observations is a claim. Cross-validation is how the claim gets tested.
Near things are more alike, and the semivariogram measures how much.
gamma(h) = mean of 0.5 * (z_i - z_j)^2 for pairs at distance h
z_i, z_j = values at two locations
h = separation distance (binned)
gamma = semivariance at that distance
small gamma = the pair still resembles
Intercept near zero distance: measurement noise plus variation finer than the sampling.
The plateau: the field's overall variance. The resemblance budget runs out.
Distance where the curve reaches the sill. Beyond it, points stop informing each other.
?
Your variogram's range is 3 km. Your sensors sit 5 km apart. What does the map between them rest on?
Twelve lines that carry the whole idea.
z_hat = sum(w_i * z_i) / sum(w_i), w_i = 1 / d_i^p
z_hat = predicted value at the target
d_i = distance to observation i
p = the power parameter
at an observation: return it exactly
Everything weighs equally: the field mean, everywhere. Maximum smoothing.
The convention, not a law. Balanced borrowing from neighbors.
Only the nearest point counts: nearest-neighbor patches, bullseyes on the map.
The lab draws the same field at p = 1, 2, 4 and lets validation pick.
Python
def idw(x_target, power):
distance = np.abs(x_obs - x_target)
if np.any(distance == 0):
return values[np.argmin(distance)]
weights = 1.0 / distance**power
return np.sum(weights * values) / np.sum(weights)
for p in [0.5, 2, 8]:
print(p, idw(5.0, p))Leave one out, and what that number does and does not say.
Take one observation out of the dataset.
Interpolate its location from the remaining 79.
Prediction versus the held-out truth.
All 80 points; the RMSE is the map's honest error.
?
IDW with a very high power reproduces every observation exactly. Why does it usually validate WORSE?
The full workflow, the distance matrix, and where kriging would start.
80 synthetic soil-moisture points with coordinates, elevation, land cover.
Variogram with range estimate; IDW maps at p = 1, 2, 4; LOO RMSE for each.
Pick a power with evidence; state where the map should not be trusted.
Python
from earthcourse.spatial import pairwise_distances_xy D = pairwise_distances_xy(points["x_km"], points["y_km"]) D.shape # (80, 80) D[3, 17] # distance between points 3 and 17 # upper triangle: 80 * 79 / 2 = 3,160 unique pairs
| This week | Next week | Bridge idea |
|---|---|---|
| Predict in space, validate by holdout | Environmental modeling | Predict in time with physics, validate on the year the model never saw |
?
Your campus installs 10 new soil sensors. Using this week's vocabulary, what one number would you estimate first to place them, and why?