公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
ee.Classifier.amnhMaxent
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
建立最大熵分類器。Maxent 會使用已知物種出現位置和大量「背景」位置的環境資料,模擬物種分布機率。如要瞭解詳情及引用,請參閱:https://biodiversityinformatics.amnh.org/open_source/maxent/ 和參考出版品:Phillips 等人,2004 A maximum entropy approach to species distribution modeling, Proceedings of the Twenty-First International Conference on Machine Learning. 輸出內容是名為「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 | 清單,預設值為空值 | 類別輸入名稱清單。如果輸入內容未列於這個引數中,系統會視為連續輸入。 |
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) | 要套用至所有鉸鏈特徵的正規化參數;負值可啟用自動設定。 |
betaLqp | 浮點值 (預設值為 -1) | 要套用至所有線性、二次和產品特徵的正規化參數;負值會啟用自動設定。 |
betaCategorical | 浮點值 (預設值為 -1) | 要套用至所有類別特徵的正規化參數;負值會啟用自動設定。 |
betaThreshold | 浮點值 (預設值為 -1) | 要套用至所有門檻特徵的正規化參數;負值會啟用自動設定。 |
extrapolate | 布林值,預設值為 true | 推算。預測訓練期間遇到的限制以外的環境空間區域。 |
doClamp | 布林值,預設值為 true | 對輸出內容套用箝位。 |
writeClampGrid | 布林值,預設值為 true | 在輸出內容中新增頻帶 (「clamp」),顯示夾鉗的空間分布。在每個點,值都是有和沒有箝制的預測值之間的絕對差異。 |
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 環境頁面,瞭解 Python API 和如何使用 geemap
進行互動式開發。
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)
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間: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,[]]