geetools.classification#

Module for classification tools.

Module Contents#

Functions#

binaryMetrics(truth, classified, scale[, region])

Get accuracy from a truth image and a classified image.

binaryRasterAccuracy(truth, classified[, region])

Get a class raster with the following classes.

geetools.classification.binaryMetrics(truth, classified, scale, region=None)[source]#

Get accuracy from a truth image and a classified image.

names from: https://en.wikipedia.org/wiki/Evaluation_of_binary_classifiers

Parameters:
  • truth (ee.Image) – binary truth image. Only the first band will be used

  • classified (ee.Image) – the classification results. Only the first band will be used

  • scale (int) – the scale for the analysis

  • region (ee.Geometry) – the region for the analysis.

Returns:

a dictionary with the following

TPR = True Positive Rate, recall or sensitivity TNR = True Negative Rate, selectivity or specificity PPV = Positive Predictive Value or precision NPV = Negative Predictive Value FNR = False Negative Rate or miss rate FPR = False Positive Rate or fall-out FDR = False Discovery Rate FOR = False Omission Rate TS = Threat score ACC = Accuracy BA = Balanced Accuracy F1 = F1 score :rtype: ee.ConfusionMatrix

geetools.classification.binaryRasterAccuracy(truth, classified, region=None)[source]#

Get a class raster with the following classes.

band “classes”: 0: no change detected and no real change (true negative) 1: no change detected but real change (false negative) 2: change detected but not real change (false positive) 3: change detected and real change (true positive)

band “truth”: 0: no change 1: change

source: https://en.wikipedia.org/wiki/Evaluation_of_binary_classifiers

For both truth and classified image input, it only uses the first band, therefore there is no need to specify a band.

Parameters:
  • truth (ee.Image) – binary image with ground truth. Only the first band will be used

  • classified (ee.Image) – classified binary image. Only the first band will be used

  • region (ee.Geometry) – region for clipping the truth and classified images