Skip to contents

step_measure_baseline_arpls() creates a specification of a recipe step that applies arPLS baseline correction using asymmetric weighting.

Usage

step_measure_baseline_arpls(
  recipe,
  measures = NULL,
  lambda = 1e+05,
  ratio = 0.001,
  max_iter = 50L,
  tol = 0.001,
  role = NA,
  trained = FALSE,
  skip = FALSE,
  id = recipes::rand_id("measure_baseline_arpls")
)

Arguments

recipe

A recipe object.

measures

An optional character vector of measure column names.

lambda

Smoothing parameter. Larger values produce smoother baselines. Default is 1e5.

ratio

Asymmetric weighting ratio. Default is 0.001.

max_iter

Maximum number of iterations. Default is 50.

tol

Convergence tolerance. Default is 1e-3.

role

Not used.

trained

Logical indicating if the step has been trained.

skip

Logical. Should the step be skipped when baking?

id

Unique step identifier.

Value

An updated recipe with the new step added.

Details

The arPLS algorithm uses asymmetric least squares with a ratio-based weighting scheme. It is robust to peak interference and works well for signals with varying baseline curvature.

Reference: Baek et al. (2015), Analyst 140, 250-257

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_arpls(lambda = 1e5) |>
  prep()