Learn R Programming

sits (version 1.12.0)

sits_classify: Classify a sits tibble using machine learning models

Description

This function classifies a set of time series, given a set of training samples, an inference model, and an interval. To perform the classification, users should provide a set of labelled samples. Each samples should be associated to one spatial location (latitude/longitude), one time interval and a label.

After defining the training samples, the users need to provide a machine learning model. Currenly, sits supports the following models: 'svm' (see sits_svm), 'random forest' (see sits_rfor), 'lda' (see sits_lda), 'qda' (see sits_qda), multinomial logit' (see sits_mlr), 'lasso' (see sits_mlr), and 'ridge' (see sits_mlr).

The model should be precomputed by the user. This model should be passed to the function using the parameter "ml_model".

Usage

sits_classify(data.tb = NULL, ml_model = NULL, interval = "12 month",
  multicores = 1)

Arguments

data.tb

Tibble with time series metadata and data.

ml_model

Pre-built machine learning model (see sits_train).

interval

Interval used for classification (in months).

multicores

Number of threads to process the time series.

Value

A tibble with the predicted labels for each input segment.

Examples

Run this code
# NOT RUN {
# Retrieve the set of samples for the Mato Grosso region (provided by EMBRAPA)
data(samples_mt_ndvi)
# select the bands "ndvi", "evi", "nir", and "mir"
samples.tb <- sits_select_bands(samples_mt_9classes, ndvi, evi, nir, mir)
# build a classification model using SVM
model_svm <- sits_train(samples.tb, ml_method = sits_svm())
# Retrieve a time series and select the bands "ndvi", "evi", "nir", and "mir"
point.tb <- sits_select_bands(point_mt_6bands, ndvi, evi, nir, mir)
# classify the point
class.tb <- sits_classify(point.tb, ml_model = model_svm)
# plot the classification
sits_plot(class.tb)
# }

Run the code above in your browser using DataLab