Earth Engine 将推出
非商业配额层级 ,以保护共享计算资源并确保为所有人提供可靠的性能。所有非商业项目都需要在
2026 年 4 月 27 日 之前选择配额层级,否则系统会默认使用 Community 层级。层级配额将于
2026 年 4 月 27 日 对所有项目生效(无论层级选择日期如何)。
了解详情。
发送反馈
ee.ConfusionMatrix.accuracy
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
计算混淆矩阵的总体准确率,定义为“正确数 / 总数”。
用法 返回 ConfusionMatrix. accuracy ()浮点数
参数 类型 详细信息 此:confusionMatrix ConfusionMatrix
示例
代码编辑器 (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 API 和如何使用 geemap 进行交互式开发,请参阅
Python 环境 页面。
import ee
import geemap.core as geemap
Colab (Python)
# 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 )
display ( "Constructed confusion matrix:" , confusion_matrix )
# Calculate overall accuracy.
display ( "Overall accuracy:" , confusion_matrix . accuracy ())
# Calculate consumer's accuracy, also known as user's accuracy or
# specificity and the complement of commission error (1 − commission error).
display ( "Consumer's accuracy:" , confusion_matrix . consumersAccuracy ())
# Calculate producer's accuracy, also known as sensitivity and the
# compliment of omission error (1 − omission error).
display ( "Producer's accuracy:" , confusion_matrix . producersAccuracy ())
# Calculate kappa statistic.
display ( "Kappa statistic:" , confusion_matrix . kappa ())
发送反馈
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可 获得了许可,并且代码示例已根据 Apache 2.0 许可 获得了许可。有关详情,请参阅 Google 开发者网站政策 。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-10-30。
需要向我们提供更多信息?
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-10-30。"],[],["The content details the computation of a confusion matrix's overall accuracy, calculated as correct predictions divided by the total. It demonstrates how to construct a `ConfusionMatrix` object from an array, representing actual vs. predicted values. The `accuracy()` method returns a float representing this overall accuracy. Other methods shown include calculating consumer's and producer's accuracy, and the kappa statistic using a `ConfusionMatrix`. Both JavaScript and Python examples are provided.\n"]]