ee.ConfusionMatrix.producersAccuracy

計算混淆矩陣中每個資料欄的生產者準確率,定義為 (正確 / 總計)。

用量傳回
ConfusionMatrix.producersAccuracy()陣列
引數類型詳細資料
這個:confusionMatrixConfusionMatrix

範例

程式碼編輯器 (JavaScript)

// Construct a confusion matrix from an array (rows are actual values,
// columns are predicted values). We construct a confusion matrix here for
// brevity and clear visualization, in most applications the confusion matrix
// will be generated from ee.Classifier.confusionMatrix.
var array = ee.Array([[32, 0, 0,  0,  1, 0],
                      [ 0, 5, 0,  0,  1, 0],
                      [ 0, 0, 1,  3,  0, 0],
                      [ 0, 1, 4, 26,  8, 0],
                      [ 0, 0, 0,  7, 15, 0],
                      [ 0, 0, 0,  1,  0, 5]]);
var confusionMatrix = ee.ConfusionMatrix(array);
print("Constructed confusion matrix", confusionMatrix);

// Calculate overall accuracy.
print("Overall accuracy", confusionMatrix.accuracy());

// Calculate consumer's accuracy, also known as user's accuracy or
// specificity and the complement of commission error (1 − commission error).
print("Consumer's accuracy", confusionMatrix.consumersAccuracy());

// Calculate producer's accuracy, also known as sensitivity and the
// compliment of omission error (1 − omission error).
print("Producer's accuracy", confusionMatrix.producersAccuracy());

// Calculate kappa statistic.
print('Kappa statistic', confusionMatrix.kappa());

Python 設定

請參閱 Python 環境頁面,瞭解 Python API 和如何使用 geemap 進行互動式開發。

import ee
import geemap.core as geemap

Colab (Python)

from pprint import pprint

# Construct a confusion matrix from an array (rows are actual values,
# columns are predicted values). We construct a confusion matrix here for
# brevity and clear visualization, in most applications the confusion matrix
# will be generated from ee.Classifier.confusionMatrix.
array = ee.Array([[32, 0, 0,  0,  1, 0],
                  [ 0, 5, 0,  0,  1, 0],
                  [ 0, 0, 1,  3,  0, 0],
                  [ 0, 1, 4, 26,  8, 0],
                  [ 0, 0, 0,  7, 15, 0],
                  [ 0, 0, 0,  1,  0, 5]])
confusion_matrix = ee.ConfusionMatrix(array)
print("Constructed confusion matrix:")
pprint(confusion_matrix.getInfo())

# Calculate overall accuracy.
print("Overall accuracy:", confusion_matrix.accuracy().getInfo())

# Calculate consumer's accuracy, also known as user's accuracy or
# specificity and the complement of commission error (1 − commission error).
print("Consumer's accuracy:")
pprint(confusion_matrix.consumersAccuracy().getInfo())

# Calculate producer's accuracy, also known as sensitivity and the
# compliment of omission error (1 − omission error).
print("Producer's accuracy:")
pprint(confusion_matrix.producersAccuracy().getInfo())

# Calculate kappa statistic.
print("Kappa statistic:", confusion_matrix.kappa().getInfo())