Predict a raster map based on a superClass model fit.
useful to separate model fitting from spatial prediction, which can take some time.
## S3 method for class 'superClass' predict(object, img, predType = "raw", filename = NULL, datatype = "INT2U", ...)
object |
superClass object |
img |
Raster object. Layernames must correspond to layernames used to train the superClass model, i.e. layernames in the original raster image. |
predType |
Character. Type of the final output raster. Either "raw" for class predictions or "prob" for class probabilities. Class probabilities are not available for all classification models (predict.train). |
filename |
Character or NULL. Filename for output raster file. |
datatype |
Datatype of output raster file. |
... |
Further arguments passed to writeRaster. |
## Load training data
data(rlogo)
train <- readRDS(system.file("external/trainingPoints.rds", package="RStoolbox"))
## Fit classifier
SC <- superClass(rlogo, trainData = train, responseCol = "class",
model = "rf", tuneLength = 1, predict = FALSE)
map <- predict(SC, rlogo)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.