Learn R Programming

sits (version 0.10.0)

sits_FCN: Train a model using the a full Convolutional Neural Network

Description

Use the a full 1D CNN algorithm to classify data. Users can define the number of convolutional layers, the size of the convolutional kernels, and the activation functions.

The FCN has been proposed for time series classification by Wang et al. The SITS implementation of FCN is based on the work of Hassan Fawaz and collaborators. Fawaz provides a reference Keras implementation of FCN in https://github.com/hfawaz/dl-4-tsc. If you use this function, please cite the references.

Usage

sits_FCN(
  samples = NULL,
  layers = c(128, 256, 128),
  kernels = c(9, 7, 5),
  activation = "relu",
  L2_rate = 1e-06,
  optimizer = keras::optimizer_adam(lr = 0.001),
  epochs = 150,
  batch_size = 128,
  validation_split = 0.2,
  verbose = 1
)

Arguments

samples

Time series with the training samples.

layers

Vector with size of the 1D convolutional filters for each layer.

kernels

Vector with size of the 1D convolutional kernels.

activation

Activation function for 1D convolution. Valid values: 'relu', 'elu', 'selu', 'sigmoid'.

L2_rate

Regularization rate for 1D convolution.

optimizer

Function with a pointer to the optimizer function (default is optimization_adam()). Options: optimizer_adadelta(), optimizer_adagrad(), optimizer_adam(), optimizer_adamax(), optimizer_nadam(), optimizer_rmsprop(), optimizer_sgd().

epochs

Number of iterations to train the model.

batch_size

Number of samples per gradient update.

validation_split

Number between 0 and 1. Fraction of training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the x and y data provided, before shuffling.

verbose

Verbosity mode (0 = silent, 1 = progress bar, 2 = one line per epoch).

Value

A model fitted to input data to be passed to sits_classify

References

Hassan Fawaz, Germain Forestier, Jonathan Weber, Lhassane Idoumghar, and Pierre-Alain Muller, "Deep learning for time series classification: a review", Data Mining and Knowledge Discovery, 33(4): 917--963, 2019.

Zhiguang Wang, Weizhong Yan, and Tim Oates, "Time series classification from scratch with deep neural networks: A strong baseline", 2017 international joint conference on neural networks (IJCNN).

Examples

Run this code
# NOT RUN {
# Retrieve the set of samples for the Mato Grosso region

# Build a machine learning model based on deep learning
fcn_model <- sits_train(samples_mt_4bands, sits_FCN())
# Plot the model
plot(fcn_model)

# get a point and classify the point with the ml_model
point <- sits_select(point_mt_6bands,
    bands = c("NDVI", "EVI", "NIR", "MIR")
)
point_class <- sits_classify(point.tb, cnn_model)
plot(point_class, bands = c("NDVI", "EVI"))
# }

Run the code above in your browser using DataLab