公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.ConfusionMatrix.order
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
返回矩阵的行和列的名称及顺序。
用法 | 返回 |
---|
ConfusionMatrix.order() | 列表 |
参数 | 类型 | 详细信息 |
---|
此:confusionMatrix | ConfusionMatrix | |
示例
代码编辑器 (JavaScript)
// Construct an error/confusion matrix from an array (rows are actual values,
// columns are predicted values). We construct an error matrix here for brevity
// and matrix 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 cmDefaultOrder = ee.ConfusionMatrix(array);
print('Default name and order of the rows and columns',
cmDefaultOrder.order());
var order = [11, 22, 42, 52, 71, 81];
var cmSpecifiedOrder = ee.ConfusionMatrix({array: array, order: order});
print('Specified name and order of the rows and columns',
cmSpecifiedOrder.order());
Python 设置
如需了解 Python API 和如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
# Construct an error/confusion matrix from an array (rows are actual values,
# columns are predicted values). We construct an error matrix here for brevity
# and matrix 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]])
cm_default_order = ee.ConfusionMatrix(array)
print('Default name and order of the rows and columns:',
cm_default_order.order().getInfo())
order = [11, 22, 42, 52, 71, 81]
cm_specified_order = ee.ConfusionMatrix(array, order)
print('Specified name and order of the rows and columns:',
cm_specified_order.order().getInfo())
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003eConfusionMatrix.order()\u003c/code\u003e returns a list containing the names and order of rows and columns within the confusion matrix.\u003c/p\u003e\n"],["\u003cp\u003eBy default, \u003ccode\u003eConfusionMatrix\u003c/code\u003e automatically assigns an order to rows and columns if not explicitly specified.\u003c/p\u003e\n"],["\u003cp\u003eUsers can define a custom order for rows and columns when creating a \u003ccode\u003eConfusionMatrix\u003c/code\u003e using the \u003ccode\u003eorder\u003c/code\u003e parameter.\u003c/p\u003e\n"],["\u003cp\u003eThis function is crucial for understanding the structure and organization of a confusion matrix, especially when interpreting its values.\u003c/p\u003e\n"]]],["The `ConfusionMatrix.order()` method returns a list representing the name and order of the rows and columns within a confusion matrix. By default, this order is determined by the matrix's structure. Users can specify a custom order when creating the `ConfusionMatrix`, which will then be reflected in the output of `order()`. The examples illustrate how to retrieve both the default and a user-defined row and column order.\n"],null,["# ee.ConfusionMatrix.order\n\nReturns the name and order of the rows and columns of the matrix.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------------|---------|\n| ConfusionMatrix.order`()` | List |\n\n| Argument | Type | Details |\n|-------------------------|-----------------|---------|\n| this: `confusionMatrix` | ConfusionMatrix | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Construct an error/confusion matrix from an array (rows are actual values,\n// columns are predicted values). We construct an error matrix here for brevity\n// and matrix visualization, in most applications the confusion matrix will be\n// generated from ee.Classifier.confusionMatrix.\nvar array = ee.Array([[32, 0, 0, 0, 1, 0],\n [ 0, 5, 0, 0, 1, 0],\n [ 0, 0, 1, 3, 0, 0],\n [ 0, 1, 4, 26, 8, 0],\n [ 0, 0, 0, 7, 15, 0],\n [ 0, 0, 0, 1, 0, 5]]);\n\nvar cmDefaultOrder = ee.ConfusionMatrix(array);\nprint('Default name and order of the rows and columns',\n cmDefaultOrder.order());\n\nvar order = [11, 22, 42, 52, 71, 81];\nvar cmSpecifiedOrder = ee.ConfusionMatrix({array: array, order: order});\nprint('Specified name and order of the rows and columns',\n cmSpecifiedOrder.order());\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Construct an error/confusion matrix from an array (rows are actual values,\n# columns are predicted values). We construct an error matrix here for brevity\n# and matrix visualization, in most applications the confusion matrix will be\n# generated from ee.Classifier.confusionMatrix.\narray = ee.Array([[32, 0, 0, 0, 1, 0],\n [ 0, 5, 0, 0, 1, 0],\n [ 0, 0, 1, 3, 0, 0],\n [ 0, 1, 4, 26, 8, 0],\n [ 0, 0, 0, 7, 15, 0],\n [ 0, 0, 0, 1, 0, 5]])\n\ncm_default_order = ee.ConfusionMatrix(array)\nprint('Default name and order of the rows and columns:',\n cm_default_order.order().getInfo())\n\norder = [11, 22, 42, 52, 71, 81]\ncm_specified_order = ee.ConfusionMatrix(array, order)\nprint('Specified name and order of the rows and columns:',\n cm_specified_order.order().getInfo())\n```"]]