View source: R/predict.priorityelasticnet.R
predict.priorityelasticnet | R Documentation |
Makes predictions for a priorityelasticnet
object. It can be chosen between linear predictors or fitted values.
## S3 method for class 'priorityelasticnet'
predict(
object,
newdata = NULL,
type = c("link", "response"),
handle.missingtestdata = c("none", "omit.prediction", "set.zero", "impute.block"),
include.allintercepts = FALSE,
use.blocks = "all",
alpha = 1,
...
)
object |
An object of class |
newdata |
(nnew |
type |
Specifies the type of predictions. |
handle.missingtestdata |
Specifies how to deal with missing data in the test data; possibilities are |
include.allintercepts |
should the intercepts from all blocks included in the prediction? If |
use.blocks |
determines which blocks are used for the prediction, the default is all. Otherwise one can specify the number of blocks which are used in a vector |
alpha |
Elastic net mixing parameter used in the model fitting. |
... |
Further arguments passed to or from other methods. |
handle.missingtestdata
specifies how to deal with missing data.
The default none
cannot handle missing data, omit.prediction
does not make a prediction for observations with missing values and return NA
. set.zero
ignores
the missing data for the calculation of the prediction (the missing value is set to zero).
impute.block
uses an imputation model to impute the offset of a missing block. This only works if the priorityelasticnet object was fitted with handle.missingdata = "impute.offset"
.
If impute.offset.cases = "complete.cases"
was used, then every observation can have only one missing block. For observations with more than one missing block, NA
is returned.
If impute.offset.cases = "available.cases"
was used, the missingness pattern in the test data has to be the same as in the train data. For observations with an unknown missingness pattern, NA
is returned.
Predictions that depend on type
.
pl_bin <- priorityelasticnet(X = matrix(rnorm(50*190),50,190), Y = rbinom(50,1,0.5),
family = "binomial", type.measure = "auc",
blocks = list(block1=1:13,block2=14:80, block3=81:190),
block1.penalization = TRUE, lambda.type = "lambda.min",
standardize = FALSE, nfolds = 3, alpha = 1)
newdata_bin <- matrix(rnorm(10*190),10,190)
predict(object = pl_bin, newdata = newdata_bin, type = "response", alpha = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.