View source: R/wavelet_denoise.R
| step_wavelet_denoise | R Documentation |
step_wavelet_denoise() creates a specification of a recipe step that
denoises the spectra with wavelet_denoise().
step_wavelet_denoise(
recipe,
...,
wavelet = "la8",
level = 2,
threshold = "sure",
rule = "hard",
segments = TRUE,
role = NA,
trained = FALSE,
columns = NULL,
skip = FALSE,
id = recipes::rand_id("wavelet_denoise")
)
recipe |
A recipe object. The step will be added to the sequence of operations for this recipe. |
... |
One or more selector functions to choose the predictors (for
example, the spectral channels). See |
wavelet |
The wavelet: |
level |
The number of levels thresholded. Default is 2: the scales of 2 to 4 channels. |
threshold |
The threshold: |
rule |
The thresholding rule: |
segments |
A logical: denoise the segments between gaps of the
wavelength axis separately ( |
role |
Not used by this step, since no new variables are created. |
trained |
A logical indicating whether the step has been trained. |
columns |
The names of the selected columns, stored once the step has been trained. |
skip |
A logical. Should the step be skipped when the recipe is baked
by |
id |
A character string that is unique to this step. |
The selected columns form one spectrum per row, and are replaced by the
denoised values. Nothing is estimated from the training data: the noise
and thresholds are those of each spectrum. The level can be tuned with
tune::tune() (dials parameter wavelet_level(), from 1 to 4 by
default). tidy() returns the terms, wavelet,
level, threshold, rule and id.
An updated version of recipe with the new step added to the
sequence of existing steps.
wavelet_denoise(), step_savgol(), step_wavelet()
if (rlang::is_installed("recipes")) {
data(forageShots)
rec <- recipes::recipe(K ~ ., data = forageShots[-c(1:4)]) |>
step_wavelet_denoise(recipes::all_predictors()) |>
recipes::prep()
recipes::tidy(rec, number = 1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.