# NOT RUN {
# Example of classification of a time series
# Retrieve the samples for Mato Grosso
# select an extreme gradient boosting model
samples_2bands <- sits_select(samples_modis_4bands,
bands = c("NDVI", "EVI"))
xgb_model <- sits_train(samples_2bands,
ml_method = sits_xgboost(verbose = FALSE)
)
# classify the point
point_2bands <- sits_select(samples_mt_6bands,
bands = c("NDVI", "EVI"))
point_class <- sits_classify(point_2bands, xgb_model)
plot(point_class)
# create a data cube based on files
data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
cube <- sits_cube(
source = "LOCAL",
name = "sinop-2014",
satellite = "TERRA",
sensor = "MODIS",
data_dir = data_dir,
delim = "_",
parse_info = c("X1", "X2", "tile", "band", "date")
)
# classify the raster image
probs_cube <- sits_classify(cube,
ml_model = xgb_model,
output_dir = tempdir(),
memsize = 4, multicores = 2
)
# label the classified image
label_cube <- sits_label_classification(probs_cube, output_dir = tempdir())
plot(label_cube)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab