classification.proto 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. // Copyright 2021 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.automl.v1;
  16. option csharp_namespace = "Google.Cloud.AutoML.V1";
  17. option go_package = "google.golang.org/genproto/googleapis/cloud/automl/v1;automl";
  18. option java_multiple_files = true;
  19. option java_outer_classname = "ClassificationProto";
  20. option java_package = "com.google.cloud.automl.v1";
  21. option php_namespace = "Google\\Cloud\\AutoMl\\V1";
  22. option ruby_package = "Google::Cloud::AutoML::V1";
  23. // Type of the classification problem.
  24. enum ClassificationType {
  25. // An un-set value of this enum.
  26. CLASSIFICATION_TYPE_UNSPECIFIED = 0;
  27. // At most one label is allowed per example.
  28. MULTICLASS = 1;
  29. // Multiple labels are allowed for one example.
  30. MULTILABEL = 2;
  31. }
  32. // Contains annotation details specific to classification.
  33. message ClassificationAnnotation {
  34. // Output only. A confidence estimate between 0.0 and 1.0. A higher value
  35. // means greater confidence that the annotation is positive. If a user
  36. // approves an annotation as negative or positive, the score value remains
  37. // unchanged. If a user creates an annotation, the score is 0 for negative or
  38. // 1 for positive.
  39. float score = 1;
  40. }
  41. // Model evaluation metrics for classification problems.
  42. // Note: For Video Classification this metrics only describe quality of the
  43. // Video Classification predictions of "segment_classification" type.
  44. message ClassificationEvaluationMetrics {
  45. // Metrics for a single confidence threshold.
  46. message ConfidenceMetricsEntry {
  47. // Output only. Metrics are computed with an assumption that the model
  48. // never returns predictions with score lower than this value.
  49. float confidence_threshold = 1;
  50. // Output only. Metrics are computed with an assumption that the model
  51. // always returns at most this many predictions (ordered by their score,
  52. // descendingly), but they all still need to meet the confidence_threshold.
  53. int32 position_threshold = 14;
  54. // Output only. Recall (True Positive Rate) for the given confidence
  55. // threshold.
  56. float recall = 2;
  57. // Output only. Precision for the given confidence threshold.
  58. float precision = 3;
  59. // Output only. False Positive Rate for the given confidence threshold.
  60. float false_positive_rate = 8;
  61. // Output only. The harmonic mean of recall and precision.
  62. float f1_score = 4;
  63. // Output only. The Recall (True Positive Rate) when only considering the
  64. // label that has the highest prediction score and not below the confidence
  65. // threshold for each example.
  66. float recall_at1 = 5;
  67. // Output only. The precision when only considering the label that has the
  68. // highest prediction score and not below the confidence threshold for each
  69. // example.
  70. float precision_at1 = 6;
  71. // Output only. The False Positive Rate when only considering the label that
  72. // has the highest prediction score and not below the confidence threshold
  73. // for each example.
  74. float false_positive_rate_at1 = 9;
  75. // Output only. The harmonic mean of [recall_at1][google.cloud.automl.v1.ClassificationEvaluationMetrics.ConfidenceMetricsEntry.recall_at1] and [precision_at1][google.cloud.automl.v1.ClassificationEvaluationMetrics.ConfidenceMetricsEntry.precision_at1].
  76. float f1_score_at1 = 7;
  77. // Output only. The number of model created labels that match a ground truth
  78. // label.
  79. int64 true_positive_count = 10;
  80. // Output only. The number of model created labels that do not match a
  81. // ground truth label.
  82. int64 false_positive_count = 11;
  83. // Output only. The number of ground truth labels that are not matched
  84. // by a model created label.
  85. int64 false_negative_count = 12;
  86. // Output only. The number of labels that were not created by the model,
  87. // but if they would, they would not match a ground truth label.
  88. int64 true_negative_count = 13;
  89. }
  90. // Confusion matrix of the model running the classification.
  91. message ConfusionMatrix {
  92. // Output only. A row in the confusion matrix.
  93. message Row {
  94. // Output only. Value of the specific cell in the confusion matrix.
  95. // The number of values each row has (i.e. the length of the row) is equal
  96. // to the length of the `annotation_spec_id` field or, if that one is not
  97. // populated, length of the [display_name][google.cloud.automl.v1.ClassificationEvaluationMetrics.ConfusionMatrix.display_name] field.
  98. repeated int32 example_count = 1;
  99. }
  100. // Output only. IDs of the annotation specs used in the confusion matrix.
  101. // For Tables CLASSIFICATION
  102. // [prediction_type][google.cloud.automl.v1p1beta.TablesModelMetadata.prediction_type]
  103. // only list of [annotation_spec_display_name-s][] is populated.
  104. repeated string annotation_spec_id = 1;
  105. // Output only. Display name of the annotation specs used in the confusion
  106. // matrix, as they were at the moment of the evaluation. For Tables
  107. // CLASSIFICATION
  108. // [prediction_type-s][google.cloud.automl.v1p1beta.TablesModelMetadata.prediction_type],
  109. // distinct values of the target column at the moment of the model
  110. // evaluation are populated here.
  111. repeated string display_name = 3;
  112. // Output only. Rows in the confusion matrix. The number of rows is equal to
  113. // the size of `annotation_spec_id`.
  114. // `row[i].example_count[j]` is the number of examples that have ground
  115. // truth of the `annotation_spec_id[i]` and are predicted as
  116. // `annotation_spec_id[j]` by the model being evaluated.
  117. repeated Row row = 2;
  118. }
  119. // Output only. The Area Under Precision-Recall Curve metric. Micro-averaged
  120. // for the overall evaluation.
  121. float au_prc = 1;
  122. // Output only. The Area Under Receiver Operating Characteristic curve metric.
  123. // Micro-averaged for the overall evaluation.
  124. float au_roc = 6;
  125. // Output only. The Log Loss metric.
  126. float log_loss = 7;
  127. // Output only. Metrics for each confidence_threshold in
  128. // 0.00,0.05,0.10,...,0.95,0.96,0.97,0.98,0.99 and
  129. // position_threshold = INT32_MAX_VALUE.
  130. // ROC and precision-recall curves, and other aggregated metrics are derived
  131. // from them. The confidence metrics entries may also be supplied for
  132. // additional values of position_threshold, but from these no aggregated
  133. // metrics are computed.
  134. repeated ConfidenceMetricsEntry confidence_metrics_entry = 3;
  135. // Output only. Confusion matrix of the evaluation.
  136. // Only set for MULTICLASS classification problems where number
  137. // of labels is no more than 10.
  138. // Only set for model level evaluation, not for evaluation per label.
  139. ConfusionMatrix confusion_matrix = 4;
  140. // Output only. The annotation spec ids used for this evaluation.
  141. repeated string annotation_spec_id = 5;
  142. }