| predict.specproc_som | R Documentation |
Places new spectra on the best-matching unit of a map fitted by som(),
with their quantization error, and flags the spectra that fit no unit.
## S3 method for class 'specproc_som'
predict(object, newdata, ...)
object |
A map fitted by |
newdata |
A numeric matrix or data frame of spectra, with the variables of the training data. |
... |
Not used. |
A tibble with one row per spectrum: its best-matching unit, the
coordinates x and y of the unit on the map, the quantization error
qe, and novel, TRUE when the error exceeds the cut-off of the
training spectra (the spectrum fits no known group).
som(), plot_som()
data(forageLIBS)
# the Na I and K I resonance lines
wl <- suppressWarnings(as.numeric(names(forageLIBS)))
spectra <- forageLIBS[which((wl > 585 & wl < 595) | (wl > 760 & wl < 780))]
fit <- som(spectra[1:300, ])
head(predict(fit, spectra[301:368, ]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.