repository
catalogue / savgol_rf

Savitzky–Golay (2nd deriv) · Random Forest

Non-linear regression — second-derivative SG + SNV feeding a 400-tree random forest.

unvalidated

Overview

Savitzky–Golay (2nd derivative) · Random Forest

A non-linear regression pipeline for when PLS underfits.

What it does

  1. Savitzky–Golay, 2nd derivativewindow_length=15, polyorder=2; resolves

overlapping absorption bands and removes baseline curvature.

  1. SNV — removes residual multiplicative scatter.
  2. Random forest — 400 trees, depth 12, evaluated with a 5-split shuffle.

When to use it

Try this when the target responds non-linearly to the spectrum, or when you want out-of-the-box feature-importance diagnostics. Expect higher variance than PLS; keep an eye on the validation/test gap.

Recipe

{
  "name": "Savitzky-Golay (2nd derivative) + Random Forest",
  "pipeline": [
    {"class": "nirs4all.operators.transforms.SavitzkyGolay", "params": {"window_length": 15, "polyorder": 2, "deriv": 2}},
    {"class": "nirs4all.operators.transforms.StandardNormalVariate"},
    {"class": "sklearn.model_selection.ShuffleSplit", "params": {"n_splits": 5, "test_size": 0.2, "random_state": 0}},
    {"model": {"class": "sklearn.ensemble.RandomForestRegressor", "params": {"n_estimators": 400, "max_depth": 12, "n_jobs": -1, "random_state": 0}}, "name": "RF-400"}
  ]
}

Use it

# Python
import nirs4all_repository as n4r
pipe = n4r.get("savgol_rf")
config = pipe.to_nirs4all()  # ready for nirs4all.run() / predict()
# any language: read the index, fetch + verify
curl https://repository.nirs4all.org/data/index.json
curl https://repository.nirs4all.org/data/pipelines/savgol_rf/pipeline.json

Metadata

framework
nirs4all
kind
recipe
task
regression
version
1.0.0
license
CeCILL-2.1 OR AGPL-3.0-or-later
trust
community
tags
random_forest, savitzky_golay, snv, nonlinear
authors
Gregory Beurier
reference
regression_demo

Expected metrics

test · rmse0.18 ±0.05
val · rmse0.155 ±0.04
statusunvalidated

Provenance

Download

recipe
pipeline.json
descriptor
descriptor.yaml