
Last chance! 50% off unlimited learning
Sale ends in
This function classifies a set of time series or data cube given
a trained model prediction model created by sits_train
.
SITS supports the following models:
support vector machines: see sits_svm
random forests: see sits_rfor
extreme gradient boosting: see sits_xgboost
multi-layer perceptrons: see sits_mlp
1D CNN: see sits_tempcnn
deep residual networks:see sits_resnet
self-attention encoders:see sits_lighttae
sits_classify(
data,
ml_model,
...,
filter_fn = NULL,
multicores = 2,
progress = TRUE
)# S3 method for sits
sits_classify(
data,
ml_model,
...,
filter_fn = NULL,
multicores = 2,
progress = TRUE
)
# S3 method for raster_cube
sits_classify(
data,
ml_model,
...,
roi = NULL,
filter_fn = NULL,
impute_fn = sits_impute_linear(),
start_date = NULL,
end_date = NULL,
memsize = 8,
multicores = 2,
output_dir,
version = "v1",
verbose = FALSE,
progress = TRUE
)
Predicted data (classified time series) or a data cube with probabilities for each class.
Data cube.
R model trained by sits_train
.
Other parameters for specific functions.
Smoothing filter to be applied (if desired).
Number of cores to be used for classification.
Show progress bar?
Region of interest (see below)
Impute function to replace NA.
Start date for the classification.
End date for the classification.
Memory available for classification (in GB).
Directory for output file.
Version of the output (for multiple classifications).
Print information about processing time?
Rolf Simoes, rolf.simoes@inpe.br
Gilberto Camara, gilberto.camara@inpe.br
if (sits_run_examples()) {
# Example of classification of a time series
# Retrieve the samples for Mato Grosso
# train a random forest model
rf_model <- sits_train(samples_modis_ndvi, ml_method = sits_rfor)
# classify the point
point_ndvi <- sits_select(point_mt_6bands, bands = c("NDVI"))
point_class <- sits_classify(
data = point_ndvi, ml_model = rf_model
)
plot(point_class)
# Example of classification of a data cube
# create a data cube from local files
data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
cube <- sits_cube(
source = "BDC",
collection = "MOD13Q1-6",
data_dir = data_dir
)
# classify a data cube
probs_cube <- sits_classify(
data = cube, ml_model = rf_model, output_dir = tempdir()
)
# label the probability cube
label_cube <- sits_label_classification(
probs_cube, output_dir = tempdir()
)
# plot the classified image
plot(label_cube)
}
Run the code above in your browser using DataLab