ee.ConfusionMatrix.array
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trả về ma trận nhầm lẫn dưới dạng một mảng.
Cách sử dụng | Giá trị trả về |
---|
ConfusionMatrix.array() | Mảng |
Đối số | Loại | Thông tin chi tiết |
---|
this: confusionMatrix | ConfusionMatrix | |
Ví dụ
Trình soạn thảo mã (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("ee.ConfusionMatrix", confusionMatrix);
print("ee.ConfusionMatrix as ee.Array", confusionMatrix.array());
Thiết lập Python
Hãy xem trang
Môi trường Python để biết thông tin về API Python và cách sử dụng geemap
cho quá trình phát triển tương tác.
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("ee.ConfusionMatrix:")
pprint(confusion_matrix.getInfo())
print("ee.ConfusionMatrix as ee.Array:")
pprint(confusion_matrix.array().getInfo())
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eConfusionMatrix.array()\u003c/code\u003e function returns the confusion matrix as an \u003ccode\u003eee.Array\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eThis function is used to access the underlying data of an \u003ccode\u003eee.ConfusionMatrix\u003c/code\u003e object for further analysis or visualization.\u003c/p\u003e\n"],["\u003cp\u003eThe confusion matrix represents the performance of a classifier, with rows indicating actual values and columns indicating predicted values.\u003c/p\u003e\n"],["\u003cp\u003eYou can create an \u003ccode\u003eee.ConfusionMatrix\u003c/code\u003e from an existing \u003ccode\u003eee.Array\u003c/code\u003e or by using the \u003ccode\u003eee.Classifier.confusionMatrix()\u003c/code\u003e function.\u003c/p\u003e\n"]]],[],null,["# ee.ConfusionMatrix.array\n\nReturns a confusion matrix as an Array.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------------|---------|\n| ConfusionMatrix.array`()` | Array |\n\n| Argument | Type | Details |\n|-------------------------|-----------------|---------|\n| this: `confusionMatrix` | ConfusionMatrix | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Construct a confusion matrix from an array (rows are actual values,\n// columns are predicted values). We construct a confusion matrix here for\n// brevity and clear visualization, in most applications the confusion matrix\n// will be 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]]);\nvar confusionMatrix = ee.ConfusionMatrix(array);\nprint(\"ee.ConfusionMatrix\", confusionMatrix);\n\nprint(\"ee.ConfusionMatrix as ee.Array\", confusionMatrix.array());\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# Construct a confusion matrix from an array (rows are actual values,\n# columns are predicted values). We construct a confusion matrix here for\n# brevity and clear visualization, in most applications the confusion matrix\n# will be 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]])\nconfusion_matrix = ee.ConfusionMatrix(array)\nprint(\"ee.ConfusionMatrix:\")\npprint(confusion_matrix.getInfo())\n\nprint(\"ee.ConfusionMatrix as ee.Array:\")\npprint(confusion_matrix.array().getInfo())\n```"]]