View source: R/dgp-lib-utils.R
return_DGP_output | R Documentation |
Helper function that returns a consistent output for any DGP function.
return_DGP_output(X, y, support, data_split, train_prop, return_values)
X |
Data matrix or data frame. |
y |
Response vector. |
support |
Vector of feature indices in the true support of the DGP. |
data_split |
Logical; if |
train_prop |
Proportion of data in training set if |
return_values |
Character vector indicating what objects to return in list. Elements in vector must be one of "X", "y", "support". |
A list of the named objects that were requested in
return_values
. See brief descriptions below.
A data.frame
.
A response vector of length nrow(X)
.
A vector of feature indices indicating all features used in the true support of the DGP.
Note that if data_split = TRUE
and "X", "y"
are in return_values
, then the returned list also contains slots for
"Xtest" and "ytest".
# Return training/test splits using iris data and completely dense support dgp_out <- return_DGP_output(X = iris %>% dplyr::select(-Species), y = iris$Species, support = 1:4, data_split = TRUE, train_prop = 0.5, return_values = c("X", "y", "support"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.