classification.proto 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. // Copyright 2020 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.v1beta1;
  16. import "google/cloud/automl/v1beta1/temporal.proto";
  17. import "google/api/annotations.proto";
  18. option go_package = "google.golang.org/genproto/googleapis/cloud/automl/v1beta1;automl";
  19. option java_outer_classname = "ClassificationProto";
  20. option java_package = "com.google.cloud.automl.v1beta1";
  21. option php_namespace = "Google\\Cloud\\AutoMl\\V1beta1";
  22. option ruby_package = "Google::Cloud::AutoML::V1beta1";
  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. // Contains annotation details specific to video classification.
  42. message VideoClassificationAnnotation {
  43. // Output only. Expresses the type of video classification. Possible values:
  44. //
  45. // * `segment` - Classification done on a specified by user
  46. // time segment of a video. AnnotationSpec is answered to be present
  47. // in that time segment, if it is present in any part of it. The video
  48. // ML model evaluations are done only for this type of classification.
  49. //
  50. // * `shot`- Shot-level classification.
  51. // AutoML Video Intelligence determines the boundaries
  52. // for each camera shot in the entire segment of the video that user
  53. // specified in the request configuration. AutoML Video Intelligence
  54. // then returns labels and their confidence scores for each detected
  55. // shot, along with the start and end time of the shot.
  56. // WARNING: Model evaluation is not done for this classification type,
  57. // the quality of it depends on training data, but there are no
  58. // metrics provided to describe that quality.
  59. //
  60. // * `1s_interval` - AutoML Video Intelligence returns labels and their
  61. // confidence scores for each second of the entire segment of the video
  62. // that user specified in the request configuration.
  63. // WARNING: Model evaluation is not done for this classification type,
  64. // the quality of it depends on training data, but there are no
  65. // metrics provided to describe that quality.
  66. string type = 1;
  67. // Output only . The classification details of this annotation.
  68. ClassificationAnnotation classification_annotation = 2;
  69. // Output only . The time segment of the video to which the
  70. // annotation applies.
  71. TimeSegment time_segment = 3;
  72. }
  73. // Model evaluation metrics for classification problems.
  74. // Note: For Video Classification this metrics only describe quality of the
  75. // Video Classification predictions of "segment_classification" type.
  76. message ClassificationEvaluationMetrics {
  77. // Metrics for a single confidence threshold.
  78. message ConfidenceMetricsEntry {
  79. // Output only. Metrics are computed with an assumption that the model
  80. // never returns predictions with score lower than this value.
  81. float confidence_threshold = 1;
  82. // Output only. Metrics are computed with an assumption that the model
  83. // always returns at most this many predictions (ordered by their score,
  84. // descendingly), but they all still need to meet the confidence_threshold.
  85. int32 position_threshold = 14;
  86. // Output only. Recall (True Positive Rate) for the given confidence
  87. // threshold.
  88. float recall = 2;
  89. // Output only. Precision for the given confidence threshold.
  90. float precision = 3;
  91. // Output only. False Positive Rate for the given confidence threshold.
  92. float false_positive_rate = 8;
  93. // Output only. The harmonic mean of recall and precision.
  94. float f1_score = 4;
  95. // Output only. The Recall (True Positive Rate) when only considering the
  96. // label that has the highest prediction score and not below the confidence
  97. // threshold for each example.
  98. float recall_at1 = 5;
  99. // Output only. The precision when only considering the label that has the
  100. // highest prediction score and not below the confidence threshold for each
  101. // example.
  102. float precision_at1 = 6;
  103. // Output only. The False Positive Rate when only considering the label that
  104. // has the highest prediction score and not below the confidence threshold
  105. // for each example.
  106. float false_positive_rate_at1 = 9;
  107. // Output only. The harmonic mean of [recall_at1][google.cloud.automl.v1beta1.ClassificationEvaluationMetrics.ConfidenceMetricsEntry.recall_at1] and [precision_at1][google.cloud.automl.v1beta1.ClassificationEvaluationMetrics.ConfidenceMetricsEntry.precision_at1].
  108. float f1_score_at1 = 7;
  109. // Output only. The number of model created labels that match a ground truth
  110. // label.
  111. int64 true_positive_count = 10;
  112. // Output only. The number of model created labels that do not match a
  113. // ground truth label.
  114. int64 false_positive_count = 11;
  115. // Output only. The number of ground truth labels that are not matched
  116. // by a model created label.
  117. int64 false_negative_count = 12;
  118. // Output only. The number of labels that were not created by the model,
  119. // but if they would, they would not match a ground truth label.
  120. int64 true_negative_count = 13;
  121. }
  122. // Confusion matrix of the model running the classification.
  123. message ConfusionMatrix {
  124. // Output only. A row in the confusion matrix.
  125. message Row {
  126. // Output only. Value of the specific cell in the confusion matrix.
  127. // The number of values each row has (i.e. the length of the row) is equal
  128. // to the length of the `annotation_spec_id` field or, if that one is not
  129. // populated, length of the [display_name][google.cloud.automl.v1beta1.ClassificationEvaluationMetrics.ConfusionMatrix.display_name] field.
  130. repeated int32 example_count = 1;
  131. }
  132. // Output only. IDs of the annotation specs used in the confusion matrix.
  133. // For Tables CLASSIFICATION
  134. //
  135. // [prediction_type][google.cloud.automl.v1beta1.TablesModelMetadata.prediction_type]
  136. // only list of [annotation_spec_display_name-s][] is populated.
  137. repeated string annotation_spec_id = 1;
  138. // Output only. Display name of the annotation specs used in the confusion
  139. // matrix, as they were at the moment of the evaluation. For Tables
  140. // CLASSIFICATION
  141. //
  142. // [prediction_type-s][google.cloud.automl.v1beta1.TablesModelMetadata.prediction_type],
  143. // distinct values of the target column at the moment of the model
  144. // evaluation are populated here.
  145. repeated string display_name = 3;
  146. // Output only. Rows in the confusion matrix. The number of rows is equal to
  147. // the size of `annotation_spec_id`.
  148. // `row[i].example_count[j]` is the number of examples that have ground
  149. // truth of the `annotation_spec_id[i]` and are predicted as
  150. // `annotation_spec_id[j]` by the model being evaluated.
  151. repeated Row row = 2;
  152. }
  153. // Output only. The Area Under Precision-Recall Curve metric. Micro-averaged
  154. // for the overall evaluation.
  155. float au_prc = 1;
  156. // Output only. The Area Under Precision-Recall Curve metric based on priors.
  157. // Micro-averaged for the overall evaluation.
  158. // Deprecated.
  159. float base_au_prc = 2 [deprecated = true];
  160. // Output only. The Area Under Receiver Operating Characteristic curve metric.
  161. // Micro-averaged for the overall evaluation.
  162. float au_roc = 6;
  163. // Output only. The Log Loss metric.
  164. float log_loss = 7;
  165. // Output only. Metrics for each confidence_threshold in
  166. // 0.00,0.05,0.10,...,0.95,0.96,0.97,0.98,0.99 and
  167. // position_threshold = INT32_MAX_VALUE.
  168. // ROC and precision-recall curves, and other aggregated metrics are derived
  169. // from them. The confidence metrics entries may also be supplied for
  170. // additional values of position_threshold, but from these no aggregated
  171. // metrics are computed.
  172. repeated ConfidenceMetricsEntry confidence_metrics_entry = 3;
  173. // Output only. Confusion matrix of the evaluation.
  174. // Only set for MULTICLASS classification problems where number
  175. // of labels is no more than 10.
  176. // Only set for model level evaluation, not for evaluation per label.
  177. ConfusionMatrix confusion_matrix = 4;
  178. // Output only. The annotation spec ids used for this evaluation.
  179. repeated string annotation_spec_id = 5;
  180. }