View source: R/step-pd-degree.R
| step_pd_degree | R Documentation |
The function step_pd_degree() creates a specification of a
recipe step that will separate data sets of persistent pairs by homological
degree. The input and output must be list-columns.
step_pd_degree(
recipe,
...,
role = "persistence diagram",
trained = FALSE,
hom_degrees = NULL,
columns = NULL,
keep_original_cols = FALSE,
skip = FALSE,
id = rand_id("pd_degree")
)
recipe |
A recipe object. The step will be added to the sequence of operations for this recipe. |
... |
One or more selector functions to choose variables for this step.
See |
role |
For model terms created by this step, what analysis role should they be assigned? By default, the new columns created by this step from the original variables will be used as predictors in a model. |
trained |
A logical to indicate if the quantities for preprocessing have been estimated. |
hom_degrees |
Integer vector of homological degrees. |
columns |
A character string of the selected variable names. This field
is a placeholder and will be populated once |
keep_original_cols |
A logical to keep the original variables in the
output. Defaults to |
skip |
A logical. Should the step be skipped when the recipe is baked by
|
id |
A character string that is unique to this step to identify it. |
Additional details...
The hom_degrees argument sets the homological degrees for which to return
new list-columns. If not NULL (the default), it is intersected with the
degrees found in any specified columns of the training data; otherwise all
found degrees are used. This parameter cannot be tuned.
An updated version of recipe with the new step added to the
sequence of any existing operations.
Other topological feature extraction via persistent homology:
step_pd_point_cloud(),
step_pd_raster()
dat <- data.frame(
roads = I(list(eurodist, UScitiesD * 1.6)),
topos = I(list(volcano, 255 - volcano))
)
ph_rec <- recipe(~ ., data = dat) %>%
step_pd_point_cloud(roads, keep_original_cols = FALSE) %>%
step_pd_raster(topos, keep_original_cols = FALSE) %>%
step_pd_degree(roads_pd, topos_pd)
ph_prep <- prep(ph_rec, training = dat)
(ph_res <- bake(ph_prep, dat))
tidy(ph_rec, number = 3)
tidy(ph_prep, number = 3)
with_degs <- recipe(~ ., data = dat) %>%
step_pd_point_cloud(roads, keep_original_cols = FALSE) %>%
step_pd_raster(topos, keep_original_cols = FALSE) %>%
step_pd_degree(roads_pd, topos_pd, hom_degrees = c(1, 2))
with_degs <- prep(with_degs, training = dat)
bake(with_degs, dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.