Learn R Programming

sits (version 0.10.0)

sits_accuracy: Area-weighted classification accuracy assessment

Description

To use this function the input table should be a set of results containing both the label assigned by the user and the classification result. Accuracy assessment set us a confusion matrix to determine the accuracy of your classified result. This function uses an area-weighted technique proposed by Olofsson et al. to produce more reliable accuracy estimates at 95

This function performs an accuracy assessment of the classified, including Overall Accuracy, User's Accuracy, Producer's Accuracy and error matrix (confusion matrix) according to [1-3].

Usage

sits_accuracy(label_cube, validation_csv)

Arguments

label_cube

A tibble with metadata about the classified maps.

validation_csv

A CSV file path with validation data

Value

A list of lists: The error_matrix, the class_areas, the unbiased estimated areas, the standard error areas, confidence interval 95 and the accuracy (user, producer, and overall), or NULL if the data is empty.

References

[1] Olofsson, P., Foody, G.M., Stehman, S.V., Woodcock, C.E. (2013). Making better use of accuracy data in land change studies: Estimating accuracy and area and quantifying uncertainty using stratified estimation. Remote Sensing of Environment, 129, pp.122-131.

[2] Olofsson, P., Foody G.M., Herold M., Stehman, S.V., Woodcock, C.E., Wulder, M.A. (2014) Good practices for estimating area and assessing accuracy of land change. Remote Sensing of Environment, 148, pp. 42-57.

[3] FAO, Map Accuracy Assessment and Area Estimation: A Practical Guide. National forest monitoring assessment working paper No.46/E, 2016.

Examples

Run this code
# NOT RUN {
# get the samples for Mato Grosso for bands NDVI and EVI
samples_mt_ndvi <- sits_select(samples_mt_4bands, bands = c("NDVI"))
# filter the samples for three classes (to simplify the example)
samples_mt_ndvi <- dplyr::filter(samples_mt_ndvi, label %in%
  c("Forest", "Pasture", "Soy_Corn"))
# build an XGB model
xgb_model <- sits_train(
  samples_mt_ndvi,
  sits_xgboost(nrounds = 10, verbose = FALSE)
)

# files that make up the data cube
ndvi_file <- c(system.file("extdata/raster/mod13q1/sinop-ndvi-2014.tif",
  package = "sits"
))
# create the data cube
sinop_2014 <- sits_cube(
    type = "BRICK",
    name = "sinop-2014",
    timeline = timeline_2013_2014,
    satellite = "TERRA",
    sensor = "MODIS",
    bands = c("NDVI"),
    files = c(ndvi_file)
)

# classify the data cube with xgb model
sinop_2014_probs <- sits_classify(sinop_2014,
  xgb_model,
  output_dir = tempdir(),
  memsize = 4,
  multicores = 1
)
# label the classification
sinop_2014_label <- sits_label_classification(sinop_2014_probs,
  output_dir = tempdir()
)
# get ground truth points
ground_truth <- system.file("extdata/samples/samples_sinop_crop.csv",
  package = "sits"
)
# calculate accuracy according to Olofsson's method
accuracy <- suppressWarnings(sits_accuracy(sinop_2014_label, ground_truth))
# }

Run the code above in your browser using DataLab