【问题标题】:Google Earth Engine Random Forest Classifier谷歌地球引擎随机森林分类器
【发布时间】:2021-12-16 19:33:52
【问题描述】:

我是 Gabriele,我尝试创建一个用于测量的脚本(使用 Google 地球引擎)。准确地说,我正在使用谷歌地球引擎对土地覆盖进行分类。 我在使用“随机森林分类器”时发现了一个问题。我的目的是得到一个值在 0 和 1 之间的结果(参见“gridcoll_classifier”行或下图),但我只得到二进制值! 我在这里附上了整个代码:

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);

以及带有脚本的图像和生成的资产……:

【问题讨论】:

  • 我删除了python标签,似乎无关
  • issue tracker报告问题

标签: javascript google-apps-script google-earth-engine


【解决方案1】:

需要设置分类器的输出方式。 smileRandomForest 分类器的默认值是分类,这就是为什么你会得到 0 或 1 的二进制输出。

如果您想要分类属性的概率分数,请尝试以下操作:

var gridcoll_classifier = ee.Classifier.smileRandomForest(20).train({
  features: trainingPartition,
  classProperty: ClassProperty,
  inputProperties: ['S_mean', 'S_std']
}).setOutputMode('PROBABILITY');

输出模式的其他选项在文档中列出:https://developers.google.com/earth-engine/apidocs/ee-classifier-setoutputmode

【讨论】:

    猜你喜欢
    • 2018-02-18
    • 2018-05-20
    • 2018-03-05
    • 1970-01-01
    • 2019-09-05
    • 2013-09-22
    • 2019-08-11
    • 2020-07-02
    • 1970-01-01
    相关资源
    最近更新 更多