predict_xtune {xtune} | R Documentation |
Model predictions based on fitted xtune
object
Description
predict_xtune
produces predicted values fitting an xtune model to a new dataset
Usage
predict_xtune(object, newX, type = c("response", "class"), ...)
Arguments
object |
Fitted 'xtune' model object. |
newX |
Matrix of values at which predictions are to be made. |
type |
Type of prediction required. For "linear" models it gives the fitted values. Type "response" gives the fitted probability scores of each category for "binary" or "multiclass" outcome. Type "class" applies to "binary" or "multiclass" models, and produces the class label corresponding to the maximum probability. |
... |
Not used |
Details
coef
and predict
methods are provided as a convenience to extract coefficients and make prediction. predict_xtune
simply calculate the predicted value using the estimated coefficients returned by xtune
.
Value
A vector of predictions
See Also
xtune
, coef_xtune
Examples
## If no Z provided, perform Empirical Bayes tuning
## simulate linear data
set.seed(9)
data(example)
X <- example$X
Y <- example$Y
Z <- example$Z
fit.eb <- xtune(X,Y)
coef_xtune(fit.eb)
predict_xtune(fit.eb,X)
## Feature specific shrinkage based on external information Z:
## simulate multi-categorical data
data(example.multiclass)
X <- example.multiclass$X
Y <- example.multiclass$Y
Z <- example.multiclass$Z
fit <- xtune(X,Y,Z,family = "multiclass")
## Coef and predict methods
coef_xtune(fit)
predict_xtune(fit,X, type = "class")
[Package xtune version 2.0.0 Index]