I am Gabriele and I tried to create a scrip for surveying (using Google Earth Engine). Precisely, I am using google earth engine to classify land cover. I found a problem using the ‘Random Forest Classifier’. My purpose is to get a result (see the row ‘gridcoll_classifier’ or the image below) with a value between 0 and 1, but I got binary values only! I attached the whole code right here:
var gridcoll = ee.FeatureCollection('users/gabrielenicolanapoli/gridcoll_merged_modified');
//Classifier
var withRandom = gridcoll.randomColumn('random');
var split = 0.7; //70% training, 30% testing.
var trainingPartition = withRandom.filter(ee.Filter.lt('random', split));
var testingPartition = withRandom.filter(ee.Filter.gte('random', split));
print(trainingPartition)
//Filtering out the null property values and try again.
//var trainingNoNulls = trainingPartition.filter(ee.Filter.notNull(trainingPartition.propertyNames()));
var ClassProperty = 'bool_str';
//Training the classifer and applying it with the filtered training collection.
var gridcoll_classifier = ee.Classifier.smileRandomForest(20).train({
features: trainingPartition,
classProperty: ClassProperty,
inputProperties: ['S_mean', 'S_std']
});
print('Gridcoll Classifier', gridcoll_classifier);
var test = testingPartition.classify(gridcoll_classifier, 'gridcoll_classifier');
print('Gridcoll_test', test);
And the image with the script and the resulting asset…: