I have a problem with random forest classification, receiving an error message after inputting the training dataset. My code includes a long preprocessing for Sentinel1 and Sentinel2, but here I'll simply summarize the code here (starting from line 248) GEE code: https://code.earthengine.google.com/3e844f7bd2cfa702709853fc78497dc4
//input the training data
var trainingData = ee.FeatureCollection('projects/ee-2023swedenagb/assets/Swe2017sample_ROI1');
//using sampleRegion to extract the values from S1 and S2 image
var s2_sample = s2L2017c1_6_Veg.sampleRegions({
collection: trainingData,
scale: 10,
properties: ['AGB_DW'],
projection: 'EPSG:3006'
});
print(s2_sample)
var s1_sample = s1L20171_6_predb.sampleRegions({
collection: trainingData,
scale: 10,
properties: ['AGB_DW'],
projection: 'EPSG:3006'
});
print(s1_sample)
//there are 211 pixels being extracted as the training data separately from S1 and S2
//merge the output from sampleRegion S1, S2
var S1S2_2017_sample = s2_sample.merge(s1_sample)
print(S1S2_2017_sample)
//now there are 422 pixels being printed, which means the merge() function merges the S1 S2 but in different rows of data (but the 211 pixels are the same)
//using addBands function to combine the whole S1, S2 images
var S1_2017_VV = s1L20171_6_predb.select('VV');
var S1_2017_VH = s1L20171_6_predb.select('VH');
var S1S2_2017 = s2L2017c1_6_Veg.addBands(S1_2017_VV).addBands(S1_2017_VH);
print(S1S2_2017);
//selecting all the bands I need to input into the random forest model
var variables2017 = S1S2_2017.select(['VV','VH','B1','B2','B3','B4','B5','B6','B7','B8','B8A','B9','B11','B12','NDVI','RVI','EVI','NDVIn','NDVIre','DVI','Vigreen','GNDVI','SAVI','MSAVI','ARVI','NDI45']);
//using random forest as the first trial to calculate the image, also where the error occured
var classifier = ee.Classifier.randomForest(10).train({
feature: S1S2_2017_sample,
classProperty: 'AGB_DW',
inputProperties: variables2017
})
var classified = variables2017.classify(classifier)
Map.addLayer(classified)
and the error says
Line 315: Required argument (features) missing to function: Classifier.train(classifier, features, classProperty, inputProperties, subsampling, subsamplingSeed)
Trains the classifier on a collection of features, using the specified numeric properties of each feature as training data. The geometry of the features is ignored.
I learn this method from a video from Google Earth (https://www.youtube.com/watch?v=6KIJB4A6VbI), but I'm not really sure why the error occurred.