evaluation.proto 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.documentai.v1beta3;
  16. import "google/api/resource.proto";
  17. import "google/protobuf/timestamp.proto";
  18. option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3";
  19. option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "DocumentAiEvaluation";
  22. option java_package = "com.google.cloud.documentai.v1beta3";
  23. option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3";
  24. option ruby_package = "Google::Cloud::DocumentAI::V1beta3";
  25. // An evaluation of a ProcessorVersion's performance.
  26. message Evaluation {
  27. option (google.api.resource) = {
  28. type: "documentai.googleapis.com/Evaluation"
  29. pattern: "projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}"
  30. };
  31. // Evaluation counters for the documents that were used.
  32. message Counters {
  33. // How many documents were sent for evaluation.
  34. int32 input_documents_count = 1;
  35. // How many documents were not included in the evaluation as they didn't
  36. // pass validation.
  37. int32 invalid_documents_count = 2;
  38. // How many documents were not included in the evaluation as Document AI
  39. // failed to process them.
  40. int32 failed_documents_count = 3;
  41. // How many documents were used in the evaluation.
  42. int32 evaluated_documents_count = 4;
  43. }
  44. // Evaluation metrics, either in aggregate or about a specific entity.
  45. message Metrics {
  46. // The calculated precision.
  47. float precision = 1;
  48. // The calculated recall.
  49. float recall = 2;
  50. // The calculated f1 score.
  51. float f1_score = 3;
  52. // The amount of occurrences in predicted documents.
  53. int32 predicted_occurrences_count = 4;
  54. // The amount of occurrences in ground truth documents.
  55. int32 ground_truth_occurrences_count = 5;
  56. // The amount of documents with a predicted occurrence.
  57. int32 predicted_document_count = 10;
  58. // The amount of documents with a ground truth occurrence.
  59. int32 ground_truth_document_count = 11;
  60. // The amount of true positives.
  61. int32 true_positives_count = 6;
  62. // The amount of false positives.
  63. int32 false_positives_count = 7;
  64. // The amount of false negatives.
  65. int32 false_negatives_count = 8;
  66. // The amount of documents that had an occurrence of this label.
  67. int32 total_documents_count = 9;
  68. }
  69. // Evaluations metrics, at a specific confidence level.
  70. message ConfidenceLevelMetrics {
  71. // The confidence level.
  72. float confidence_level = 1;
  73. // The metrics at the specific confidence level.
  74. Metrics metrics = 2;
  75. }
  76. // Metrics across multiple confidence levels.
  77. message MultiConfidenceMetrics {
  78. // A type that determines how metrics should be interpreted.
  79. enum MetricsType {
  80. // The metrics type is unspecified. By default, metrics without a
  81. // particular specification are for leaf entity types (i.e., top-level
  82. // entity types without child types, or child types which are not
  83. // parent types themselves).
  84. METRICS_TYPE_UNSPECIFIED = 0;
  85. // Indicates whether metrics for this particular label type represent an
  86. // aggregate of metrics for other types instead of being based on actual
  87. // TP/FP/FN values for the label type. Metrics for parent (i.e., non-leaf)
  88. // entity types are an aggregate of metrics for their children.
  89. AGGREGATE = 1;
  90. }
  91. // Metrics across confidence levels with fuzzy matching enabled.
  92. repeated ConfidenceLevelMetrics confidence_level_metrics = 1;
  93. // Metrics across confidence levels with only exact matching.
  94. repeated ConfidenceLevelMetrics confidence_level_metrics_exact = 4;
  95. // The calculated area under the precision recall curve (AUPRC), computed by
  96. // integrating over all confidence thresholds.
  97. float auprc = 2;
  98. // The Estimated Calibration Error (ECE) of the confidence of the predicted
  99. // entities.
  100. float estimated_calibration_error = 3;
  101. // The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching
  102. // only.
  103. float auprc_exact = 5;
  104. // The ECE for the predicted entities with fuzzy matching disabled, i.e.,
  105. // exact matching only.
  106. float estimated_calibration_error_exact = 6;
  107. // The metrics type for the label.
  108. MetricsType metrics_type = 7;
  109. }
  110. // The resource name of the evaluation.
  111. // Format:
  112. // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}`
  113. string name = 1;
  114. // The time that the evaluation was created.
  115. google.protobuf.Timestamp create_time = 2;
  116. // Counters for the documents used in the evaluation.
  117. Counters document_counters = 5;
  118. // Metrics for all the entities in aggregate.
  119. MultiConfidenceMetrics all_entities_metrics = 3;
  120. // Metrics across confidence levels, for different entities.
  121. map<string, MultiConfidenceMetrics> entity_metrics = 4;
  122. // The KMS key name used for encryption.
  123. string kms_key_name = 6;
  124. // The KMS key version with which data is encrypted.
  125. string kms_key_version_name = 7;
  126. }