I am trying to classify using randomForest classification in GEE . However, I always get the error User memory limit exceeded, so I assume the number of the feature are too large.

Nevertheless, I saw many developers can classify even bigger dataset, so I am wondering if there is a better option there?

The code can be accessed via https://code.earthengine.google.com/23538cf3ed6b667d6e5975cb2864a436

var fire= ee.FeatureCollection('users/spatola/recovery_rf_1712').map(function(feature){
    var num = ee.Number.parse(feature.get('CLC_311'));
    return feature.set('CLC_311', num);
var indices= ['EVI_mean','Dnbr','NBR2_mean','NBR2_min','NBR2_max','EVI_min','EVI_max'];
var fire1=  fire.filter(ee.Filter.notNull(indices));
var fire2= fire1.select('Class_R','Dnbr','EVI_max','NBR2_max','imageId')
var bands= ['NBR2_max', 'EVI_max'];
var classProperty= 'Class_R';
var random= fire2.randomColumn('random');
var split_train= 0.8;
var split_test= 0.2;
var trainPartition= random.filter(ee.Filter.lt('random',split_train));
var testPartition= random.filter(ee.Filter.gte('random',split_test));

var RFtrained_c= ee.Classifier.smileRandomForest({
 numberOfTrees: 100,
 seed: 123,
    features: trainPartition,
    inputProperties: bands,
    classProperty: classProperty,
var dict =  RFtrained_c.explain();
var test = testPartition.classify(RFtrained_c)

2 Answers 2


As the FeatureCollection you want to classify is not shared, it's hard to tell whether the number of features is the problem. But unless you have hundreds of thousands of points, I don't think the number of points is the problem. As mentioned by @Elmstead, exporting the classified FC might help, using Export.table.toAsset()

Also, please be aware that you're using overlapping data for training and testing, as you are using ee.Filter.lt('random',0.8) to generate the training data (returns 80% of the data), and ee.Filter.gte('random',0.2) for the test data (also returns 80% of the data).

This is how I would split the data in 80% train, 20% test:

var trainPartition= fire2.randomColumn({seed: 1}).filter(ee.Filter.gte('random',0.2));
var testPartition= fire2.randomColumn({seed: 1}).filter(ee.Filter.lt('random',0.2));

One thing that might help is if you can execute this process as a task rather than in the console, for example by manipulating the code here that exports an image. I'm not sure what specific command you need for your application, but I do know this will give your task more time to run, if not more memory, before you hit an error.


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.