-
Notifications
You must be signed in to change notification settings - Fork 76
/
classify_ts.R
31 lines (25 loc) · 717 Bytes
/
classify_ts.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# satellite image time series package (SITS)
# example of the classification of a time series
library(sits)
# In this example, we are going to train a ML model
# and then will classify a point
# use a sample with the bands "ndvi", "evi", "nir", and "mir"
# select a random forest model
rfor_model <- sits_train(
samples = samples_modis_ndvi,
ml_method = sits_rfor()
)
# Retrieve a time series
data("point_mt_6bands")
# select the bands "ndvi", "evi", "nir", and "mir"
point_tb <- sits_select(
data = point_mt_6bands,
bands = "NDVI"
)
# classify the point
class_tb <- sits_classify(
data = point_tb,
ml_model = rfor_model
)
# plot the classification
plot(class_tb, bands = "NDVI")