← Knowledge Base
Spectral ModelsAugust 12, 2026 · 9 min read

How to build a spectral model that works outside the lab

From choosing reference samples to cross-validation. A practical step order for VIS-NIR calibration, and the most common reasons a model stops working in the field.

A spectral model is a function that computes a parameter of interest — nitrogen content, moisture, the share of an adulterant — from a reflectance spectrum. The difference between a lab model and a field model isn’t the algorithm, it’s how the data it learned from was collected.

Reference set

The foundation is a set of samples with a lab-analysis result. What matters isn’t the number of measurements but the spread: the set must cover the full range of values the model will later need to predict, including the extremes.

  • At least a few dozen samples for every level of material variability.
  • Measurements from different locations, seasons, and material batches.
  • The same measurement protocol for every reference sample.

A model will never be more accurate than the reference method it learned from.

Preparing the spectra

A raw spectrum contains effects unrelated to the parameter being studied: surface scattering, differences in measurement geometry, detector drift. Preprocessing transforms remove these components before the data reaches the model.

Space for a chart or photo
Illustration caption. This same block will hold a chart, a measurement photo, or an app screenshot.

Validation

Cross-validation results on the same set almost always look good. A trustworthy answer only comes from a test set collected independently — at a different time, on a different field, or from a different material batch.

Metrics worth reporting

Root mean square error of prediction (RMSEP), the coefficient of determination, and the range in which the model remains reliable. Without a stated range, the first two numbers say nothing useful.

Maintaining the model

Materials change — new varieties, different growing conditions, new raw-material suppliers. A model needs its reference set replenished periodically, or its accuracy drops without warning.

Want to build a model for your material?

We run the calibration together with the client: from choosing reference samples to a ready model in the app.

contact@scanspectrum.ai