predict2 | R Documentation |
This function is a wrapper around predict.train
, but it accepts a
threshold cutoff to calculate predictions from class probabilities.
predict2(object, ...) ## S3 method for class 'train' predict2(object, newdata = NULL, type = "raw", doclamp = FALSE, ...) ## S3 method for class 'list' predict2(object, ...) ## S3 method for class 'RasterStack' predict2(object, model, doclamp = FALSE, ...)
object, model |
A model returned by |
... |
Further arguments passed to |
newdata |
An optional set of data to predict on. |
type |
One of "raw", "prob", "both", "both1" or "prob1" (see details). |
doclamp |
logical. Clamp |
Most arguments work the same as predict.train
.
This function is only useful for two class Classification problems, when using
type = "raw"
and a different threshold from the default (which must set using setThreshold
).
Otherwise, the output is the same as predict
.
Additionally, you can set type = "both"
, which will return a data.frame with all class probabilities and
a prediction, type = "prob1"
to return a single vector with the first class probabilities (assumed
to be presence). type = "both1"
will return class prediction and the first class probabilities.
The method for RasterStack is a simpler version of raster::predict
, but it may be faster sometimes.
A vector or data.frame with predictions or probabilities, based on the argument type
. Check details.
If model
is a list of models, than a list of predictions is returned.
setThreshold
clamp_data
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.