get.yhat()
works as a proxy prediction function for many classes of fitted models.
Usage
get.yhat(X.model, newdata, ...)
# Default S3 method
get.yhat(X.model, newdata, target = -1L, ...)
# S3 method for class 'mid'
get.yhat(X.model, newdata, ...)
# S3 method for class 'lm'
get.yhat(X.model, newdata, ...)
# S3 method for class 'glm'
get.yhat(X.model, newdata, ...)
# S3 method for class 'rpart'
get.yhat(X.model, newdata, target = -1L, ...)
# S3 method for class 'randomForest'
get.yhat(X.model, newdata, target = -1L, ...)
# S3 method for class 'ranger'
get.yhat(X.model, newdata, target = -1L, ...)
# S3 method for class 'svm'
get.yhat(X.model, newdata, target = -1L, ...)
# S3 method for class 'ksvm'
get.yhat(X.model, newdata, target = -1L, ...)
# S3 method for class 'AccurateGLM'
get.yhat(X.model, newdata, ...)
# S3 method for class 'glmnet'
get.yhat(X.model, newdata, ...)
# S3 method for class 'model_fit'
get.yhat(X.model, newdata, target = -1L, ...)
# S3 method for class 'rpf'
get.yhat(X.model, newdata, target = -1L, ...)
Arguments
- X.model
a fitted model object.
- newdata
a data.frame or matrix.
- ...
optional parameters that are passed to the prediction method for the model.
- target
an integer or character vector specifying the target levels for the prediction, used for the models that returns a matrix or data.frame of class probabilities. Default is
-1
, representing the probability of not being the base level.
Details
get.yhat()
is a wrapper prediction function for many classes of models.
Although many predictive models have their own method of stats::predict()
, the structure and the type of the output of these methods are not uniform.
get.yhat()
is designed to always return a simple numeric vector of model predictions.
The design of get.yhat()
is strongly influenced by DALEX::yhat()
.