Description Usage Arguments Details Value References See Also Examples
Refines the edges of a chosen box in a prim
object by pasting.
1 2 3 4 5 6 7 8 9 |
object |
|
npeel |
Numeric value indicating which box to choose in |
support |
Numeric value between 0 and 1 indicating the support of the
box to choose in |
yfun |
Numeric value indicating the value of the objective function
for the chosen box in |
alpha |
The proportion of observations to add at each pasting iteration.
Usually equal to the peeling fraction used in |
obj.fun |
The objective function to maximize by pasting. See
|
peeling.side |
Constraints on the pasting side. -1 indicates pasting only on the 'left' of the box (i.e. moving the lower limit only), 1 indicate pasting only on the 'right' and 0 for no constraint. |
The function takes a prim
object and choose one of its boxes
as a starting point for pasting. Bottom-up pasting is the reverse of
of the top down peeling. It starts from the result of the peeling and
refines its edges by iteratively adding alpha
times N
observations at each iteration, where N is the number of observations
in the current box.
The best box after the peeling should be chosen by analyzing the
peeling trajectory (see plot_trajectory
).
It is given by one of: number of peeling iteration leading to the box
(argument npeel
), the closest support (argument support
),
or the closest objective function value (argument yfun
).
Although it is possible to use different algorithm parameters
(alpha
, obj.fun
, peeling.side
) than the peeling
step, it is advised to keep the same values (the default).
A prim
object which is a list with the following elements:
npeel |
The number of peeling iteration performed. |
support |
A vector of length |
yfun |
A vector of length |
limits |
A list of length |
x,y |
The input and response data used in the algorithm. |
numeric.vars |
A logical vector indicating, for each input variable, if it was considered as a numeric variable. |
alpha, peeling.side, obj.fun |
The value of the arguments used for peeling. Useful for prim methods. |
npaste |
Number of pasting iteration performed. |
Friedman, J.H., Fisher, N.I., 1999. Bump hunting in high-dimensional data. Statistics and Computing 9, 123-143. https://doi.org/10.1023/A:1008894516817
extract.box
to extract information about a
particular box in a prim
object. plot_box
to
visualize boxes. predict.prim
to predict if new data
falls into particular boxes.
1 2 3 4 5 6 7 8 9 10 11 | # A simple bump
set.seed(12345)
x <- matrix(runif(2000), ncol = 2, dimnames = list(NULL, c("x1", "x2")))
y <- 2 * x[,1] + 5 * x[,2] + 10 * (x[,1] >= .8 & x[,2] >= .5) + rnorm(1000)
# Peeling step
peel_res <- peeling(y, x)
# Pasting from the box with support 0.01
paste_res <- pasting(peel_res, support = 0.01)
# Visualize the peeled box and pasted one (npaste 0 and 2)
plot_box(paste_res, pch = 16, ypalette = hcl.colors(10), npaste = c(0, 2),
box.args = list(lwd = 2, border = c("grey", "black"), lty = 1:2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.