API
Types
AdditiveModel
AdditiveModel(models::Vector)A boosting-style composite surrogate. Each model is fitted to the residuals (target minus the sum of all previous model predictions), and the final prediction is the sum of all model predictions.
Examples
model = AdditiveModel([ImplicitTerrain.MLP(), ImplicitTerrain.MLP()])
fit!(model, raster; steps=1000)
predict(model, raster)CategoricalRasterWrap
CategoricalRasterWrap(r::Raster; kernel)A GeoSurrogate for categorical rasters using kernel smoothing. Here, “categorical raster” refers to a raster where its numerical data is associated with discrete categories (e.g. land cover types).
GeomWrap
GeomWrap(geometry; kernel)A GeoSurrogate representing a geometry. Coordinates contained in the geometry will result in predict(::GeomWrap, coords)) == 1.0. Coordinates “far” will be 0.0. “Near” coordinates are determined by the kernel function evaluated at the distance between the coordinate and the geometry.
IDW
IDW(r::Raster; power=2)Inverse Distance Weighting surrogate. Predicts values as a weighted average of known data points, where weights are inversely proportional to the distance raised to power.
Examples
model = IDW(raster)
predict(model, (x, y))
predict(model, raster)LinReg
No documentation found for public binding GeoSurrogates.LinReg.
Summary
struct GeoSurrogates.LinReg{F<:StatsModels.FormulaTerm, T<:Number}
Fields
formula :: F<:StatsModels.FormulaTerm
β :: Array{T<:Number, 1}
Supertype Hierarchy
GeoSurrogates.LinReg{F<:StatsModels.FormulaTerm, T<:Number} <: GeoSurrogates.GeoSurrogate <: Any
RBF
RBF(r::Raster; kernel=:gaussian, epsilon=1.0, poly_degree=0)Radial Basis Function surrogate. Interpolates scattered data using a kernel applied to pairwise distances. Set poly_degree=1 to augment with a linear polynomial term.
Available kernels: :gaussian, :multiquadric, :inverse_multiquadric, :linear, :cubic, :thin_plate_spline.
Examples
model = RBF(raster; kernel=:gaussian, epsilon=1.0)
predict(model, (x, y))RasterWrap
RasterWrap(r::Raster; int = BSpline(Linear()), ext = nothing)A GeoSurrogate with interpolation (and optional extrapolation).
TPS
TPS(r::Raster; regularization=0.0)Thin Plate Spline surrogate. Always includes an affine term (a₀ + a₁x + a₂y). Set regularization > 0 for smoothing instead of exact interpolation.
Examples
model = TPS(raster)
predict(model, (x, y))Functions
fit! {#fit!}
Fit a statistical model in-place.
fit!(model::WindSIREN, x::AbstractMatrix, y::AbstractMatrix; steps=1)Train the model on coordinate-value pairs.
x: 2×N matrix of normalized (x, y) coordinatesy: 2×N matrix of (u, v) wind components
Returns the fitted model.
fit!(model::WindSIREN, u::Raster, v::Raster; steps=1)Train the model on u and v wind component rasters. Rasters must be normalized before fitting.
Returns the fitted model.
fit!(model::WindSIREN, uv::RasterStack; steps=1)Train the model on a RasterStack containing :u and :v layers.
Returns the fitted model.
fit!(model::CatSIREN, x::AbstractMatrix, y::AbstractMatrix; steps=1)Train the model on coordinate-value pairs.
x: 2×N matrix of normalized (x, y) coordinatesy: n_classes×N one-hot encoded matrix
Returns the fitted model.
fit!(model::CatSIREN, r::Raster; steps=1)Train the model on a categorical raster. The raster values should be categorical labels (integers or any comparable type).
Returns the fitted model.
gaussian
No documentation found for public binding GeoSurrogates.gaussian.
GeoSurrogates.gaussian is a Function.
# 1 method for generic function "gaussian" from GeoSurrogates:
[1] gaussian(u, k)
@ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:466
normalize
No documentation found for public binding GeoSurrogates.normalize.
GeoSurrogates.normalize is a Function.
# 5 methods for generic function "normalize" from GeoSurrogates:
[1] normalize(r::Rasters.Raster)
@ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:31
[2] normalize(x::AbstractArray{<:Union{Missing, Number}})
@ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:18
[3] normalize(dim::DimensionalData.Dimensions.Dimension)
@ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:29
[4] normalize(nt::NamedTuple)
@ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:37
[5] normalize(x)
@ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:27
predict
predict(model::RegressionModel, [newX])Form the predicted response of model. An object with new covariate values newX can be supplied, which should have the same type and structure as that used to fit model; e.g. for a GLM it would generally be a DataFrame with the same variable names as the original predictors.
predict(model::WindSIREN, x::AbstractMatrix) -> Matrix{Float32}Predict wind components (u, v) for input coordinates. Input x should be a 2×N matrix of normalized coordinates. Returns a 2×N matrix where row 1 is u and row 2 is v.
predict(model::WindSIREN, coords::Tuple) -> Tuple{Float32, Float32}Predict wind components (u, v) for a single coordinate tuple (x, y). Returns (u, v) tuple.
predict(model::WindSIREN, r::Raster) -> Tuple{Raster, Raster}Predict wind components for all coordinates in a raster. Returns tuple of (uraster, vraster).
predict(model::CatSIREN, x::AbstractMatrix) -> Matrix{Float32}Predict class probabilities for input coordinates. Input x should be a 2×N matrix of normalized coordinates. Returns an n_classes×N matrix of probabilities (columns sum to 1).
predict(model::CatSIREN, coords::Tuple) -> DictPredict class probabilities for a single coordinate tuple (x, y). Returns a Dict mapping class labels to probabilities.
predict(model::CatSIREN, r::Raster) -> RasterPredict class probabilities for all coordinates in a raster. Returns a Raster where each cell contains a Dict mapping class labels to probabilities.
Constants
CatSIREN
CatSIREN(n_classes; kwargs...)A SIREN (Sinusoidal Representation Network) for creating implicit neural representations of categorical raster data (e.g., Landfire fuel models). Uses periodic sine activations with a softmax output layer to ensure predictions sum to 1.
Arguments
n_classes::Int: Number of output classes (required)
Keyword Arguments
in::Int = 2: Input dimension (typically 2 for x, y coordinates)hidden::Int = 256: Number of hidden units per layern_hidden::Int = 3: Number of hidden layersω0::Float32 = 30f0: Frequency scaling for first layerωh::Float32 = 1f0: Frequency scaling for hidden layersrng::AbstractRNG = Random.MersenneTwister(42): Random number generatoralg = Adam(0.0001f0): Optimizer algorithm
Example
# For a categorical raster with 10 unique classes
model = CatSIREN(10)
fit!(model, categorical_raster; steps=1000)
probs = predict(model, test_raster) # Returns raster of probability vectorsReferences
- Sitzmann et al. “Implicit Neural Representations with Periodic Activation Functions” (2020)
CatSIREN(r::Raster; kwargs...)Create a CatSIREN model from a categorical raster, automatically determining the number of classes from the unique values in the raster.

