Description Usage Arguments Value Note Examples
View source: R/predict.trainOcc.R
The prediction works on usual matrices/data frames, the raster*
and rasterTiled
objects. If a parallel backend for foreach
(e.g. via doParallel
)
is used for the prediction of raster*
and rasterTiled
objects. Small data sets are
are processed faster sequentially due to the parallel overhead.
1 2 3 4 |
object |
a |
newdata |
new data to predict on. |
type |
default is 'prob' which however returns the continuous decision values (see note!) |
allowParallel |
should parallel processing be allowed. |
returnRaster |
default |
mask |
if given and if |
noWarnWithParRasPred |
Supresses warning when predicting in parallel with spatial.tools. It always causes the following warning message for each worker: "In .local(x, ...) : min value not known, use setMinMax". |
... |
other arguments that can be passed to |
the predicted data, eventually returned as rasterLayer
.
type='probs'
does NOT return probabilities but the continuous
decision values of the classifier, e.g. distances in the case of the one-class
and biased svm) and not probabilities!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
data(bananas)
### fit a model
fit <- trainOcc (x = bananas$tr[, -1], y = bananas$tr[, 1], method="biasedsvm",
tuneGrid=expand.grid(sigma=c(0.1, 1),
cNeg=2^seq(-4, 2, 2),
cMultiplier=2^seq(4, 8, 2) ) )
# predict a raster
pred <- predict(fit, bananas$x)
plot(pred)
# register a parallel backend and predict in parallel with rasterEngine of spatial.tools
require(doParallel) # or use another parallel backend for foreach
cl <- makeCluster(detectCores()-1) # leave one core free if you don't want to go for coffee
registerDoParallel(cl)
pred <- predict(fit, bananas$x)
plot(pred)
stopCluster(cl)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.