According to the Google Earth Engine documentation for supervised classification, the accuracy assessment of classifiers such as ee.Classifier.smileRandomForest can be done using a confusionMatrix():

// Make a Random Forest classifier and train it.
var classifier = ee.Classifier.smileRandomForest(10)
      features: training,
      classProperty: 'Land_Cover_Type_1',
      inputProperties: ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7']

// Classify the input imagery.
var classified = input.classify(classifier);

// Get a confusion matrix representing resubstitution accuracy.
var trainAccuracy = classifier.confusionMatrix();
print('Resubstitution error matrix: ', trainAccuracy);

However, I can't seem to find information on assessing the accuracy of regression output models in Google Earth Engine, such as ee.Classifier.libsvm.


How do I conduct accuracy assessment in Earth Engine for regression models? Example:

var classifier = ee.Classifier.libsvm({
    svmType: "EPSILON_SVR",
    kernelType: "POLY",
    shrinking: true,
    degree: 3,
    cost: 1,
    terminationEpsilon: 0.001,
    lossEpsilon: 0.1})

1 Answer 1


Unfortunately, there is not yet such function in GEE; however, you could simply write the formula of RMSE or MAE in GEE.

As an example for RMSE calculation;

var observation = ee.Array([0.1,0.2,0.3,0.9])                                   
var prediction = ee.Array([0.12,0.24,0.31,0.89])

print(observation.subtract(prediction).pow(2).reduce('mean', [0]).sqrt(),'RMSE')
  • Thank you. Could you give me some advice for retrieving the array of predicted values?
    – Joris
    Jun 25, 2020 at 14:23
  • You're welcome. You could use the "sampleRegions" function and extract the predicted values for your observations and then convert it to an array. Also, note that I just provided an example , there is no necessity to convert it to array, you could run similar work with FeatureCollection as well.
    – HamiEbra
    Jun 25, 2020 at 15:15
  • Dear HamiEbra, can you give a sample with sampleRegions function, converting observations to arrays? Apr 14, 2022 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.