| step_pridit | R Documentation |
Creates a recipes preprocessing step that fits a PRIDIT model on the
training data and appends a single composite score column to any data set
passed to bake(). This enables genuine out-of-sample scoring:
the empirical CDFs used for ridit transformation and the PCA weights are
estimated on the training fold only and then applied to the test fold without
re-fitting.
step_pridit(
recipe,
...,
role = "predictor",
trained = FALSE,
score_name = "PRIDIT_score",
sign_correction = TRUE,
ecdfs = NULL,
weights = NULL,
max_eigval = NULL,
col_norms = NULL,
skip = FALSE,
id = recipes::rand_id("pridit")
)
recipe |
A |
... |
One or more selector expressions passed to
|
role |
For the new score column: passed to |
trained |
Logical. Set automatically by |
score_name |
Character. Name of the new score column.
Default |
sign_correction |
Logical. Passed to |
ecdfs |
Internal. Stored empirical CDFs from training. |
weights |
Internal. Stored PRIDIT weight vector from training. |
max_eigval |
Internal. Stored largest eigenvalue from training. |
col_norms |
Internal. Stored column norms from training. |
skip |
Logical. If |
id |
Character. Unique step identifier. |
All selected columns must be numeric. The step does not remove the original
columns; use step_rm() afterwards if a clean feature set is required.
An updated recipe.
## Not run:
library(recipes)
dat <- data.frame(
id = letters[1:50],
x1 = runif(50), x2 = runif(50), x3 = runif(50)
)
rec <- recipe(~ ., data = dat) |>
update_role(id, new_role = "id") |>
step_pridit(x1, x2, x3)
prepped <- prep(rec, training = dat)
bake(prepped, new_data = dat)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.