Create a probability map

using a random forest classifier

var referenceData = ee.FeatureCollection("users/servirmekong/cambodia/paddyRice");

var rice = referenceData.filter(ee.Filter.eq("land_class",1));
var nonrice = referenceData.filter(ee.Filter.eq("land_class",0));

// import feature collection
var table = ee.FeatureCollection("users/servirmekong/countries/KHM_adm1");
// import surface reflectance composite
var composites = ee.ImageCollection("projects/servir-mekong/yearlyComposites");

// filter for province
var province = "Batdâmbâng";

// select province from feature collection
var myProvince = table.filter(ee.Filter.eq("NAME_1","Batdâmbâng"));

// filter image for date
var image = ee.Image(composites.filterDate("2018-01-01","2018-12-31").first());

// add image to map

Map.addLayer(nonrice.draw("black"),{},"non rice");

var trainingSample = image.sampleRegions(referenceData,["land_class"],30);

var bandNames = image.bandNames();
var classifier = ee.Classifier.randomForest(100,0).setOutputMode('PROBABILITY').train(trainingSample,"land_class",bandNames);

var classification = image.classify(classifier).multiply(100);



Leave a Reply

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

You are commenting using your 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