公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.Classifier.amnhMaxent
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
创建最大熵分类器。Maxent 使用已知存在位置和大量“背景”位置的环境数据来模拟物种分布概率。如需了解详情和引用信息,请访问:https://biodiversityinformatics.amnh.org/open_source/maxent/,并参阅参考出版物:Phillips 等人,2004 年,一种用于物种分布建模的最大熵方法,第二十一届国际机器学习会议论文集。输出是一个名为“probability”的单波段,其中包含模型化概率;如果“writeClampGrid”实参为 true,则还会包含一个名为“clamp”的额外波段。
用法 | 返回 |
---|
ee.Classifier.amnhMaxent(categoricalNames, outputFormat, autoFeature, linear, quadratic, product, threshold, hinge, hingeThreshold, l2lqThreshold, lq2lqptThreshold, addSamplesToBackground, addAllSamplesToBackground, betaMultiplier, betaHinge, betaLqp, betaCategorical, betaThreshold, extrapolate, doClamp, writeClampGrid, randomTestPoints, seed) | 分类器 |
参数 | 类型 | 详细信息 |
---|
categoricalNames | 列表,默认值:null | 分类输入的名称列表。此实参中未列出的任何输入都被视为连续输入。 |
outputFormat | 字符串,默认值:“cloglog” | 输出中概率的表示形式。 |
autoFeature | 布尔值,默认值:true | 根据训练样本数量自动选择要使用的特征类。 |
linear | 布尔值,默认值:true | 允许使用线性功能。当 autofeature 为 true 时,系统会忽略此参数。 |
quadratic | 布尔值,默认值:true | 允许使用二次方特征。当 autofeature 为 true 时,系统会忽略此参数。 |
product | 布尔值,默认值:true | 允许使用产品功能。当 autofeature 为 true 时,系统会忽略此参数。 |
threshold | 布尔值,默认值:false | 允许使用阈值功能。当 autofeature 为 true 时,系统会忽略此参数。 |
hinge | 布尔值,默认值:true | 允许使用铰链功能。当 autofeature 为 true 时,系统会忽略此参数。 |
hingeThreshold | 整数,默认值:15 | 开始使用铰链特征的样本数。如果 autofeature 为 false,则忽略。 |
l2lqThreshold | 整数,默认值:10 | 开始使用二次方特征的样本数。如果 autofeature 为 false,则忽略。 |
lq2lqptThreshold | 整数,默认值:80 | 开始使用商品和阈值功能的样本数量。如果 autofeature 为 false,则忽略。 |
addSamplesToBackground | 布尔值,默认值:true | 将具有环境值组合(尚未出现在背景中)的任何样本添加到背景中。 |
addAllSamplesToBackground | 布尔值,默认值:false | 将所有样本添加到背景中,即使这些样本的环境值组合已存在于背景中也是如此。 |
betaMultiplier | 浮点数,默认值:1 | 正则化乘数。将所有自动正则化形参乘以相应数字。数值越大,分布越分散。 |
betaHinge | 浮点数,默认值:-1 | 要应用于所有 hinge 特征的正则化形参;负值表示启用自动设置。 |
betaLqp | 浮点数,默认值:-1 | 要应用于所有线性特征、二次特征和乘积特征的正则化形参;负值表示启用自动设置。 |
betaCategorical | 浮点数,默认值:-1 | 要应用于所有类别特征的正则化形参;负值表示启用自动设置。 |
betaThreshold | 浮点数,默认值:-1 | 要应用于所有阈值特征的正则化形参;负值表示启用自动设置。 |
extrapolate | 布尔值,默认值:true | 外推。预测训练期间遇到的限制之外的环境空间区域。 |
doClamp | 布尔值,默认值:true | 对输出应用钳制。 |
writeClampGrid | 布尔值,默认值:true | 在输出中添加一个频段(“钳制”),显示钳制的空间分布。在每个点,该值都是采用和不采用钳制时的预测值之间的绝对差。 |
randomTestPoints | 整数,默认值:0 | 随机测试百分比。留作测试点的训练点所占的百分比,用于计算 AUX、遗漏等。 |
seed | Long,默认值:0 | 生成随机数时使用的种子。 |
示例
代码编辑器 (JavaScript)
// Create some sample species presence/absence training data.
var trainingData = ee.FeatureCollection([
// Species present points.
ee.Feature(ee.Geometry.Point([-122.39567, 38.02740]), {presence: 1}),
ee.Feature(ee.Geometry.Point([-122.68560, 37.83690]), {presence: 1}),
// Species absent points.
ee.Feature(ee.Geometry.Point([-122.59755, 37.92402]), {presence: 0}),
ee.Feature(ee.Geometry.Point([-122.47137, 37.99291]), {presence: 0}),
ee.Feature(ee.Geometry.Point([-122.52905, 37.85642]), {presence: 0}),
ee.Feature(ee.Geometry.Point([-122.03010, 37.66660]), {presence: 0})
]);
// Import a Landsat 8 surface reflectance image.
var image = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_044034_20200606')
// Select the optical and thermal bands.
.select(['.._B.*']);
// Sample the image at the location of the points.
var training = image.sampleRegions({collection: trainingData, scale: 30});
// Define and train a Maxent classifier from the image-sampled points.
var classifier = ee.Classifier.amnhMaxent().train({
features: training,
classProperty: 'presence',
inputProperties: image.bandNames()
});
// Classify the image using the Maxent classifier.
var imageClassified = image.classify(classifier);
// Display the layers on the map.
// Species presence probability [0, 1] grades from black to white.
Map.centerObject(image, 9);
Map.addLayer(
image.select(['SR_B4', 'SR_B3', 'SR_B2']).multiply(0.0000275).add(-0.2),
{min: 0, max: 0.3}, 'Image');
Map.addLayer(
imageClassified, {bands: 'probability', min: 0, max: 1}, 'Probability');
Map.addLayer(
trainingData.filter('presence == 0'), {color: 'red'},
'Training data (species absent)');
Map.addLayer(
trainingData.filter('presence == 1'), {color: 'blue'},
'Training data (species present)');
Python 设置
如需了解 Python API 和如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
"""Demonstrates the ee.Classifier.amnhMaxent method."""
import ee
# Authenticates to the Earth Engine servers.
ee.Authenticate()
# Initializes the client library.
ee.Initialize()
# Create some sample species presence/absence training data.
training_data = ee.FeatureCollection([
# Species present points.
ee.Feature(ee.Geometry.Point([-122.39567, 38.02740]), {'presence': 1}),
ee.Feature(ee.Geometry.Point([-122.68560, 37.83690]), {'presence': 1}),
# Species absent points.
ee.Feature(ee.Geometry.Point([-122.59755, 37.92402]), {'presence': 0}),
ee.Feature(ee.Geometry.Point([-122.47137, 37.99291]), {'presence': 0}),
ee.Feature(ee.Geometry.Point([-122.52905, 37.85642]), {'presence': 0}),
ee.Feature(ee.Geometry.Point([-122.03010, 37.66660]), {'presence': 0})
])
# Import a Landsat 8 image and select the reflectance bands.
image = (ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_044034_20200606')
.select(['SR_B[1-7]'])
.multiply(0.0000275).add(-0.2)) # Apply scaling factors.
# Sample the image at the location of the points.
training = image.sampleRegions(**{
'collection': training_data,
'scale': 30
})
# Define and train a Maxent classifier from the image-sampled points.
classifier = ee.Classifier.amnhMaxent().train(**{
'features': training,
'classProperty': 'presence',
'inputProperties': image.bandNames()
})
# Classify the image using the Maxent classifier.
image_classified = image.classify(classifier)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eModels species distribution probabilities using environmental data and known presence/absence locations.\u003c/p\u003e\n"],["\u003cp\u003eEmploys the Maximum Entropy (Maxent) algorithm for modeling.\u003c/p\u003e\n"],["\u003cp\u003eOutputs a probability band representing the modeled probability of species presence.\u003c/p\u003e\n"],["\u003cp\u003eOptionally includes a "clamp" band indicating areas where the prediction was limited.\u003c/p\u003e\n"],["\u003cp\u003eRefer to Phillips et al., 2004 for further details and citation.\u003c/p\u003e\n"]]],["The core function creates a Maximum Entropy (Maxent) classifier to model species distribution probabilities. This classifier uses environmental data from known species presence locations and background locations. Key actions include training the classifier with presence/absence data, selecting features such as linear, quadratic, product, threshold, and hinge, and defining categorical inputs. The output includes a probability band, and optionally a clamp band showing the clamping difference, which is generated when using the `writeClampGrid` argument. It uses settings for extrapolation, clamping, and regularization.\n"],null,[]]