Learn R Programming

sits (version 1.1.0)

sits_rfor: Train random forest models

Description

Use Random Forest algorithm to classify samples. This function is a front-end to the "randomForest" package. Please refer to the documentation in that package for more details.

Usage

sits_rfor(samples = NULL, num_trees = 120, mtry = NULL, ...)

Value

Model fitted to input data (to be passed to sits_classify).

Arguments

samples

Time series with the training samples.

num_trees

Number of trees to grow. This should not be set to too small a number, to ensure that every input row gets predicted at least a few times (default: 120).

mtry

Number of variables randomly sampled as candidates at each split (default: NULL - use default value of randomForest::randomForest() function, i.e. floor(sqrt(features))).

...

Other parameters to be passed to `randomForest::randomForest` function.

Author

Alexandre Ywata de Carvalho, alexandre.ywata@ipea.gov.br

Rolf Simoes, rolf.simoes@inpe.br

Gilberto Camara, gilberto.camara@inpe.br

Examples

Run this code
if (sits_run_examples()) {
    # Example of training a model for time series classification
    # Retrieve the samples for Mato Grosso
    # train a random forest model
    rf_model <- sits_train(samples_modis_4bands,
                           ml_method = sits_rfor(mtry = 20))
    # select the bands to classify the point
    sample_bands <- sits_bands(samples_modis_4bands)
    point_4bands <- sits_select(point_mt_6bands, bands = sample_bands)
    # classify the point
    point_class <- sits_classify(point_4bands, rf_model)
    plot(point_class)
}

Run the code above in your browser using DataLab