
Fit a 1-D Fourier Neural Operator for depth-profile operators
Source:R/pilar8_neural_operators.R
no_fno_fit.RdLearns the solution map u(z) -> y(z) from a collection of
(covariate trajectory, target profile) pairs. The trained
operator predicts the depth profile at new sites without re-fitting.
Arguments
- depths
Numeric vector of depths (common grid, length
n_depths). Depth must be equally spaced for the DFT to be exact; if not equally spaced, the implementation falls back to a FFT on the reindexed series.- targets
Matrix of observed profile values, shape
(n_obs, n_depths). Each row is one site.- covariates
Matrix of depth-dependent covariate values, shape
(n_obs, n_depths, n_channels)– the covariate trajectory that drives the operator. A 2-D matrix is accepted and treated asn_channels = 1.- n_modes
Integer; number of Fourier modes retained in each spectral convolution. Default
4L.- width
Integer; number of latent channels. Default
8L.- n_blocks
Integer; number of FNO blocks. Default
2L.- epochs
Integer; SGD epochs.
- lr
Learning rate.
- seed
RNG seed.
- backend
"r"(default, pure-R ELM-style) or"torch"(full autograd viatorch::optim_adam; requires thetorchSuggests dependency). v2.7.0 upgrade.- device
"cpu"(default),"mps"(Apple Silicon) or"cuda"whenbackend = "torch".