
Memory-based learning prediction against the OSSL library
Source:R/spectra-predict.R
predict_ossl_mbl.RdPredicts a set of soil properties from pre-processed Vis-NIR or MIR
spectra using memory-based learning (MBL) – the recommended
OSSL workflow for heterogeneous libraries. Defaults follow the
literature (Ramirez-Lopez et al., 2013): k = 100 neighbours,
PLS-score dissimilarity, local PLS regression with 5 components,
internal leave-one-out validation.
Arguments
- X
A pre-processed numeric matrix (rows = horizons, columns = wavelengths).
- properties
Character vector of OSSL-supported property names.
- region
One of
"global","south_america","north_america","europe","africa".- k
Integer number of neighbours.
- ossl_library
Optional list with the OSSL training spectra (
Xr) and reference values (Yr, a data.frame keyed byproperties). WhenNULL, the synthetic path is used.- ...
Additional arguments forwarded to
resemble::mbl.
Value
A data.table with columns horizon_idx, property,
value, pi95_low, pi95_high, n_neighbors. The
"backend" attribute records which path was taken
("resemble" or "synthetic").
Details
If resemble::mbl is installed and an ossl_library
artefact is supplied (a list with elements Xr, Yr)
the function delegates to resemble::mbl(); otherwise it
returns a deterministic synthetic prediction conditioned on the
input spectra so that downstream code, tests and vignettes run
without external dependencies. The fallback is annotated via the
notes attribute on the returned data.table.