إشعار: يجب
إثبات أهلية جميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إلى Earth Engine.
ee.ConfusionMatrix
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تنشئ مصفوفة نجاح التوقّعات. يتوافق المحور 0 (الصفوف) للمصفوفة مع القيم الفعلية، ويتوافق المحور 1 (الأعمدة) مع القيم المتوقّعة.
الاستخدام | المرتجعات |
---|
ee.ConfusionMatrix(array, order) | ConfusionMatrix |
الوسيطة | النوع | التفاصيل |
---|
array | عنصر | مصفوفة مربّعة ثنائية الأبعاد من الأعداد الصحيحة، تمثّل مصفوفة الخطأ. يُرجى العِلم أنّه على عكس الدالة الإنشائية ee.Array، لا يمكن أن تأخذ هذه الوسيطة قائمة. |
order | قائمة، القيمة التلقائية: فارغة | حجم الصف والعمود وترتيبهما للمصفوفات غير المتجاورة أو غير المستندة إلى الصفر |
أمثلة
محرّر الرموز البرمجية (JavaScript)
// A confusion matrix. Rows correspond to actual values, columns to
// predicted values.
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]]);
print('Constructed confusion matrix',
ee.ConfusionMatrix(array));
// The "order" parameter refers to row and column class labels. When
// unspecified, the class labels are assumed to be a 0-based sequence
// incrementing by 1 with a length equal to row/column size.
print('Default row/column labels (unspecified "order" parameter)',
ee.ConfusionMatrix({array: array, order: null}).order());
// Set the "order" parameter when custom class label integers are required. The
// list of integer value labels should correspond to the matrix axes left to
// right / top to bottom.
var order = [11, 22, 42, 52, 71, 81];
print('Specified row/column labels (specified "order" parameter)',
ee.ConfusionMatrix({array: array, order: order}).order());
إعداد Python
راجِع صفحة
بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام
geemap
للتطوير التفاعلي.
import ee
import geemap.core as geemap
Colab (Python)
from pprint import pprint
# A confusion matrix. Rows correspond to actual values, columns to
# predicted values.
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]])
print('Constructed confusion matrix:')
pprint(ee.ConfusionMatrix(array).getInfo())
# The "order" parameter refers to row and column class labels. When
# unspecified, the class labels are assumed to be a 0-based sequence
# incrementing by 1 with a length equal to row/column size.
print('Default row/column labels (unspecified "order" parameter):',
ee.ConfusionMatrix(array, None).order().getInfo())
# Set the "order" parameter when custom class label integers are required. The
# list of integer value labels should correspond to the matrix axes left to
# right / top to bottom.
order = [11, 22, 42, 52, 71, 81]
print('Specified row/column labels (specified "order" parameter):',
ee.ConfusionMatrix(array, order).order().getInfo())
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eCreates a confusion matrix from a 2D array of integers, where rows represent actual values and columns represent predicted values.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eorder\u003c/code\u003e parameter can be used to specify custom class labels for the rows and columns of the matrix.\u003c/p\u003e\n"],["\u003cp\u003eIf \u003ccode\u003eorder\u003c/code\u003e is not specified, it defaults to a 0-based sequence incrementing by 1.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eee.ConfusionMatrix\u003c/code\u003e object provides methods for analyzing the confusion matrix.\u003c/p\u003e\n"]]],[],null,["# ee.ConfusionMatrix\n\nCreates a confusion matrix. Axis 0 (the rows) of the matrix correspond to the actual values, and Axis 1 (the columns) to the predicted values.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|----------------------------------------|-----------------|\n| `ee.ConfusionMatrix(array, `*order*`)` | ConfusionMatrix |\n\n| Argument | Type | Details |\n|----------|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| `array` | Object | A square, 2D array of integers, representing the confusion matrix. Note that unlike the ee.Array constructor, this argument cannot take a list. |\n| `order` | List, default: null | The row and column size and order, for non-contiguous or non-zero based matrices. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A confusion matrix. Rows correspond to actual values, columns to\n// predicted values.\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]]);\nprint('Constructed confusion matrix',\n ee.ConfusionMatrix(array));\n\n// The \"order\" parameter refers to row and column class labels. When\n// unspecified, the class labels are assumed to be a 0-based sequence\n// incrementing by 1 with a length equal to row/column size.\nprint('Default row/column labels (unspecified \"order\" parameter)',\n ee.ConfusionMatrix({array: array, order: null}).order());\n\n// Set the \"order\" parameter when custom class label integers are required. The\n// list of integer value labels should correspond to the matrix axes left to\n// right / top to bottom.\nvar order = [11, 22, 42, 52, 71, 81];\nprint('Specified row/column labels (specified \"order\" parameter)',\n ee.ConfusionMatrix({array: array, order: order}).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\nfrom pprint import pprint\n\n# A confusion matrix. Rows correspond to actual values, columns to\n# predicted values.\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]])\nprint('Constructed confusion matrix:')\npprint(ee.ConfusionMatrix(array).getInfo())\n\n# The \"order\" parameter refers to row and column class labels. When\n# unspecified, the class labels are assumed to be a 0-based sequence\n# incrementing by 1 with a length equal to row/column size.\nprint('Default row/column labels (unspecified \"order\" parameter):',\n ee.ConfusionMatrix(array, None).order().getInfo())\n\n# Set the \"order\" parameter when custom class label integers are required. The\n# list of integer value labels should correspond to the matrix axes left to\n# right / top to bottom.\norder = [11, 22, 42, 52, 71, 81]\nprint('Specified row/column labels (specified \"order\" parameter):',\n ee.ConfusionMatrix(array, order).order().getInfo())\n```"]]