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、省略等。
seedLong,預設值為 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)