Accuracy assessment

Get the confusion matrix of your classifier

nghean.png

We created a sentinel-2 composite for Nghe An and added reference points in the GEE interface. These points were used to create a training sample to train the classifier. The code below gets the stats from your classifier

var classifier = ee.Classifier.randomForest(10,0).train(TrainingSample,"land_class",bandNames);

var confMatrix = classifier.confusionMatrix()

print(confMatrix)

var OA = confMatrix.accuracy()
var CA = confMatrix.consumersAccuracy()
var Kappa = confMatrix.kappa()
var Order = confMatrix.order()
var PA = confMatrix.producersAccuracy()

print(confMatrix,'Confusion Matrix')
print(OA,'Overall Accuracy')
print(CA,'Consumers Accuracy')
print(Kappa,'Kappa')
print(Order,'Order')
print(PA,'Producers Accuracy')

find the complete example here.

3 comments

Leave a Reply to thisearthsite Cancel reply