% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spectra-predict.R
\name{predict_ossl_mbl}
\alias{predict_ossl_mbl}
\title{Memory-based learning prediction against the OSSL library}
\usage{
predict_ossl_mbl(
  X,
  properties,
  region = "global",
  k = 100L,
  ossl_library = NULL,
  ...
)
}
\arguments{
\item{X}{A pre-processed numeric matrix (rows = horizons,
columns = wavelengths).}

\item{properties}{Character vector of OSSL-supported property names.}

\item{region}{One of \code{"global"}, \code{"south_america"},
\code{"north_america"}, \code{"europe"}, \code{"africa"}.}

\item{k}{Integer number of neighbours.}

\item{ossl_library}{Optional list with the OSSL training spectra
(\code{Xr}) and reference values (\code{Yr}, a data.frame
keyed by \code{properties}). When \code{NULL}, the synthetic
path is used.}

\item{...}{Additional arguments forwarded to \code{resemble::mbl}.}
}
\value{
A data.table with columns \code{horizon_idx, property,
        value, pi95_low, pi95_high, n_neighbors}. The
        \code{"backend"} attribute records which path was taken
        (\code{"resemble"} or \code{"synthetic"}).
}
\description{
Predicts a set of soil properties from pre-processed Vis-NIR or MIR
spectra using \emph{memory-based learning} (MBL) -- the recommended
OSSL workflow for heterogeneous libraries. Defaults follow the
literature (Ramirez-Lopez et al., 2013): \code{k = 100} neighbours,
PLS-score dissimilarity, local PLS regression with 5 components,
internal leave-one-out validation.
}
\details{
If \code{resemble::mbl} is installed and an \code{ossl_library}
artefact is supplied (a list with elements \code{Xr}, \code{Yr})
the function delegates to \code{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
\code{notes} attribute on the returned data.table.
}
\references{
Ramirez-Lopez, L., Behrens, T., Schmidt, K., Stevens, A.,
Demattê, J. A. M., & Scholten, T. (2013). The spectrum-based
learner: A new local approach for modeling soil Vis-NIR spectra of
complex datasets. \emph{Geoderma}, 195--196, 268--279.
}
