Learn R Programming

sits (version 1.12.0)

sits_deeplearning: Train a sits classifiction model using the keras deep learning

Description

Use a deeplearning algorithm to classify data. This function is a front-end to the "keras" method R package. Please refer to the documentation in that package for more details.

Usage

sits_deeplearning(data.tb = NULL, units = c(512, 512, 512, 512, 512),
  activation = "elu", dropout_rates = c(0.5, 0.4, 0.35, 0.3, 0.2),
  optimizer = keras::optimizer_adam(lr = 0.001), epochs = 500,
  batch_size = 128, validation_split = 0.2, verbose = 1,
  binary_classification = FALSE)

Arguments

data.tb

Time series with the training samples.

units

Vector with the number of hidden nodes in each hidden layer.

activation

Vector with the names of activation functions. Valid values are 'relu', 'elu', 'selu', 'sigmoid'.

dropout_rates

Vector with the dropout rates (0,1) for each layer to the next layer.

optimizer

Function with a pointer to the optimizer function (default is optimization_adam()). Options are 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 the 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).

binary_classification

A lenght-one logical indicating if this is a binary classification. If it is so, the number of unique labels in the training data must be two as well.

Value

Either an model function to be passed in sits_predict or an function prepared that can be called further to compute multinom training model.

Examples

Run this code
# NOT RUN {
# Retrieve the set of samples for the Mato Grosso region (provided by EMBRAPA)
data(samples_mt_ndvi)
# Build a machine learning model based on deep learning
dl_model <- sits_train (samples_mt_ndvi,
                        sits_deeplearning(units = c(512, 512, 512),
                                          dropout_rates = c(0.50, 0.40, 0.35),
                                          epochs = 50))
# get a point with a 16 year time series
data(point_ndvi)
# classify the point
class.tb <- sits_classify (point_ndvi, dl_model)
# plot the classified point
sits_plot(class.tb)
# }

Run the code above in your browser using DataLab