View source: R/step-pd-raster.R
step_pd_raster | R Documentation |
The function step_pd_raster()
creates a specification of
a recipe step that will convert compatible data formats (numerical arrays,
including matrices, of 2, 3, or 4 dimensions) to 3-column matrix
representations of persistence diagram data. The input and output must be
list-columns.
step_pd_raster(
recipe,
...,
role = "persistence diagram",
trained = FALSE,
filtration = "cubical",
value_max = 9999L,
method = c("link_join", "compute_pairs"),
engine = NULL,
columns = NULL,
keep_original_cols = TRUE,
skip = FALSE,
id = rand_id("pd_raster")
)
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. |
filtration |
The type of filtration from which to compute persistent
homology; currently only |
value_max , method |
Parameters passed to persistence engines. |
engine |
The computational engine to use (see 'Details'). Reasonable
defaults are chosen based on |
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. |
Persistent homology (PH) is a tool of algebraic topology to extract features from data whose persistence measures their robustness to scale. The computation relies on a sequence of maps between discrete topological spaces (usually a filtration comprising only inclusions) constructed from the data.
An updated version of recipe
with the new step added to the
sequence of any existing operations.
The PH of numeric arrays such as (greyscale) digital images is computed from the cubical filtration of the pixel or voxel array, treated as a function from a cubical mesh to a finite value range.
Cubical Ripser is an efficient implementation of cubical PH and is ported
to R through ripserr
. It accepts numerical
arrays.
The value_max
argument bounds the value range along which PH is computed.
Cubical Ripser is implemented using both of two methods, link-join and
compute-pairs, controlled by the method
parameter.
This step has 1 tuning parameter(s):
max_hom_degree
: Maximum Homological Degree (type: integer, default: NULL)
Other topological feature extraction via persistent homology:
step_pd_degree()
,
step_pd_point_cloud()
topos <- data.frame(pix = I(list(volcano)))
ph_rec <- recipe(~ ., data = topos) %>%
step_pd_raster(pix)
ph_prep <- prep(ph_rec, training = topos)
ph_res <- bake(ph_prep, topos)
tidy(ph_rec, number = 1)
tidy(ph_prep, number = 1)
with(ph_res$pix_pd[[1]], plot(
x = birth, y = death, pch = dimension + 1, col = dimension + 1,
xlab = NA, ylab = "", asp = 1
))
with_max <- recipe(~ ., data = topos) %>%
step_pd_raster(pix, value_max = 150)
with_max <- prep(with_max, training = topos)
bake(with_max, topos)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.