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.

Advertisements

3 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s