View source: R/predict.xtune.R
predict_xtune | R Documentation |
xtune
objectpredict_xtune
produces predicted values fitting an xtune model to a new dataset
predict_xtune(object, newX, type = c("response", "class"), ...)
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 |
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
.
A vector of predictions
xtune
, coef_xtune
## 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.