Automatic Baseline Correction Method Selection
Source:R/baseline-extended.R
step_measure_baseline_auto.Rdstep_measure_baseline_auto() creates a specification of a recipe step
that automatically selects and applies the best baseline correction method
based on signal characteristics.
Arguments
- recipe
A recipe object.
- measures
An optional character vector of measure column names.
- methods
Character vector of methods to consider. Default includes all available methods.
- role
Not used.
- trained
Logical indicating if the step has been trained.
- selected_method
The method selected during training (internal).
- skip
Logical. Should the step be skipped when baking?
- id
Unique step identifier.
Details
This step analyzes the signal characteristics (noise level, baseline curvature, peak density) during training and selects an appropriate baseline correction method. The selected method is then applied consistently during baking.
Method selection heuristics:
High noise, smooth baseline: rolling ball
Complex curvature: airPLS or arPLS
Sharp peaks: SNIP or top-hat
Simple baseline: polynomial or minima
See also
Other measure-baseline:
step_measure_baseline_airpls(),
step_measure_baseline_als(),
step_measure_baseline_arpls(),
step_measure_baseline_custom(),
step_measure_baseline_gpc(),
step_measure_baseline_minima(),
step_measure_baseline_morph(),
step_measure_baseline_poly(),
step_measure_baseline_py(),
step_measure_baseline_rf(),
step_measure_baseline_rolling(),
step_measure_baseline_snip(),
step_measure_baseline_tophat(),
step_measure_detrend()
Examples
library(recipes)
rec <- recipe(water + fat + protein ~ ., data = meats_long) |>
update_role(id, new_role = "id") |>
step_measure_input_long(transmittance, location = vars(channel)) |>
step_measure_baseline_auto() |>
prep()