1*d5c09012SAndroid Build Coastguard Worker// Copyright 2020 Google LLC 2*d5c09012SAndroid Build Coastguard Worker// 3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); 4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License. 5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at 6*d5c09012SAndroid Build Coastguard Worker// 7*d5c09012SAndroid Build Coastguard Worker// http://www.apache.org/licenses/LICENSE-2.0 8*d5c09012SAndroid Build Coastguard Worker// 9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software 10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, 11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and 13*d5c09012SAndroid Build Coastguard Worker// limitations under the License. 14*d5c09012SAndroid Build Coastguard Worker 15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3"; 16*d5c09012SAndroid Build Coastguard Worker 17*d5c09012SAndroid Build Coastguard Workerpackage google.cloud.automl.v1beta1; 18*d5c09012SAndroid Build Coastguard Worker 19*d5c09012SAndroid Build Coastguard Workerimport "google/cloud/automl/v1beta1/temporal.proto"; 20*d5c09012SAndroid Build Coastguard Worker 21*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/automl/apiv1beta1/automlpb;automlpb"; 22*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "ClassificationProto"; 23*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.cloud.automl.v1beta1"; 24*d5c09012SAndroid Build Coastguard Workeroption php_namespace = "Google\\Cloud\\AutoMl\\V1beta1"; 25*d5c09012SAndroid Build Coastguard Workeroption ruby_package = "Google::Cloud::AutoML::V1beta1"; 26*d5c09012SAndroid Build Coastguard Worker 27*d5c09012SAndroid Build Coastguard Worker// Type of the classification problem. 28*d5c09012SAndroid Build Coastguard Workerenum ClassificationType { 29*d5c09012SAndroid Build Coastguard Worker // An un-set value of this enum. 30*d5c09012SAndroid Build Coastguard Worker CLASSIFICATION_TYPE_UNSPECIFIED = 0; 31*d5c09012SAndroid Build Coastguard Worker 32*d5c09012SAndroid Build Coastguard Worker // At most one label is allowed per example. 33*d5c09012SAndroid Build Coastguard Worker MULTICLASS = 1; 34*d5c09012SAndroid Build Coastguard Worker 35*d5c09012SAndroid Build Coastguard Worker // Multiple labels are allowed for one example. 36*d5c09012SAndroid Build Coastguard Worker MULTILABEL = 2; 37*d5c09012SAndroid Build Coastguard Worker} 38*d5c09012SAndroid Build Coastguard Worker 39*d5c09012SAndroid Build Coastguard Worker// Contains annotation details specific to classification. 40*d5c09012SAndroid Build Coastguard Workermessage ClassificationAnnotation { 41*d5c09012SAndroid Build Coastguard Worker // Output only. A confidence estimate between 0.0 and 1.0. A higher value 42*d5c09012SAndroid Build Coastguard Worker // means greater confidence that the annotation is positive. If a user 43*d5c09012SAndroid Build Coastguard Worker // approves an annotation as negative or positive, the score value remains 44*d5c09012SAndroid Build Coastguard Worker // unchanged. If a user creates an annotation, the score is 0 for negative or 45*d5c09012SAndroid Build Coastguard Worker // 1 for positive. 46*d5c09012SAndroid Build Coastguard Worker float score = 1; 47*d5c09012SAndroid Build Coastguard Worker} 48*d5c09012SAndroid Build Coastguard Worker 49*d5c09012SAndroid Build Coastguard Worker// Contains annotation details specific to video classification. 50*d5c09012SAndroid Build Coastguard Workermessage VideoClassificationAnnotation { 51*d5c09012SAndroid Build Coastguard Worker // Output only. Expresses the type of video classification. Possible values: 52*d5c09012SAndroid Build Coastguard Worker // 53*d5c09012SAndroid Build Coastguard Worker // * `segment` - Classification done on a specified by user 54*d5c09012SAndroid Build Coastguard Worker // time segment of a video. AnnotationSpec is answered to be present 55*d5c09012SAndroid Build Coastguard Worker // in that time segment, if it is present in any part of it. The video 56*d5c09012SAndroid Build Coastguard Worker // ML model evaluations are done only for this type of classification. 57*d5c09012SAndroid Build Coastguard Worker // 58*d5c09012SAndroid Build Coastguard Worker // * `shot`- Shot-level classification. 59*d5c09012SAndroid Build Coastguard Worker // AutoML Video Intelligence determines the boundaries 60*d5c09012SAndroid Build Coastguard Worker // for each camera shot in the entire segment of the video that user 61*d5c09012SAndroid Build Coastguard Worker // specified in the request configuration. AutoML Video Intelligence 62*d5c09012SAndroid Build Coastguard Worker // then returns labels and their confidence scores for each detected 63*d5c09012SAndroid Build Coastguard Worker // shot, along with the start and end time of the shot. 64*d5c09012SAndroid Build Coastguard Worker // WARNING: Model evaluation is not done for this classification type, 65*d5c09012SAndroid Build Coastguard Worker // the quality of it depends on training data, but there are no 66*d5c09012SAndroid Build Coastguard Worker // metrics provided to describe that quality. 67*d5c09012SAndroid Build Coastguard Worker // 68*d5c09012SAndroid Build Coastguard Worker // * `1s_interval` - AutoML Video Intelligence returns labels and their 69*d5c09012SAndroid Build Coastguard Worker // confidence scores for each second of the entire segment of the video 70*d5c09012SAndroid Build Coastguard Worker // that user specified in the request configuration. 71*d5c09012SAndroid Build Coastguard Worker // WARNING: Model evaluation is not done for this classification type, 72*d5c09012SAndroid Build Coastguard Worker // the quality of it depends on training data, but there are no 73*d5c09012SAndroid Build Coastguard Worker // metrics provided to describe that quality. 74*d5c09012SAndroid Build Coastguard Worker string type = 1; 75*d5c09012SAndroid Build Coastguard Worker 76*d5c09012SAndroid Build Coastguard Worker // Output only . The classification details of this annotation. 77*d5c09012SAndroid Build Coastguard Worker ClassificationAnnotation classification_annotation = 2; 78*d5c09012SAndroid Build Coastguard Worker 79*d5c09012SAndroid Build Coastguard Worker // Output only . The time segment of the video to which the 80*d5c09012SAndroid Build Coastguard Worker // annotation applies. 81*d5c09012SAndroid Build Coastguard Worker TimeSegment time_segment = 3; 82*d5c09012SAndroid Build Coastguard Worker} 83*d5c09012SAndroid Build Coastguard Worker 84*d5c09012SAndroid Build Coastguard Worker// Model evaluation metrics for classification problems. 85*d5c09012SAndroid Build Coastguard Worker// Note: For Video Classification this metrics only describe quality of the 86*d5c09012SAndroid Build Coastguard Worker// Video Classification predictions of "segment_classification" type. 87*d5c09012SAndroid Build Coastguard Workermessage ClassificationEvaluationMetrics { 88*d5c09012SAndroid Build Coastguard Worker // Metrics for a single confidence threshold. 89*d5c09012SAndroid Build Coastguard Worker message ConfidenceMetricsEntry { 90*d5c09012SAndroid Build Coastguard Worker // Output only. Metrics are computed with an assumption that the model 91*d5c09012SAndroid Build Coastguard Worker // never returns predictions with score lower than this value. 92*d5c09012SAndroid Build Coastguard Worker float confidence_threshold = 1; 93*d5c09012SAndroid Build Coastguard Worker 94*d5c09012SAndroid Build Coastguard Worker // Output only. Metrics are computed with an assumption that the model 95*d5c09012SAndroid Build Coastguard Worker // always returns at most this many predictions (ordered by their score, 96*d5c09012SAndroid Build Coastguard Worker // descendingly), but they all still need to meet the confidence_threshold. 97*d5c09012SAndroid Build Coastguard Worker int32 position_threshold = 14; 98*d5c09012SAndroid Build Coastguard Worker 99*d5c09012SAndroid Build Coastguard Worker // Output only. Recall (True Positive Rate) for the given confidence 100*d5c09012SAndroid Build Coastguard Worker // threshold. 101*d5c09012SAndroid Build Coastguard Worker float recall = 2; 102*d5c09012SAndroid Build Coastguard Worker 103*d5c09012SAndroid Build Coastguard Worker // Output only. Precision for the given confidence threshold. 104*d5c09012SAndroid Build Coastguard Worker float precision = 3; 105*d5c09012SAndroid Build Coastguard Worker 106*d5c09012SAndroid Build Coastguard Worker // Output only. False Positive Rate for the given confidence threshold. 107*d5c09012SAndroid Build Coastguard Worker float false_positive_rate = 8; 108*d5c09012SAndroid Build Coastguard Worker 109*d5c09012SAndroid Build Coastguard Worker // Output only. The harmonic mean of recall and precision. 110*d5c09012SAndroid Build Coastguard Worker float f1_score = 4; 111*d5c09012SAndroid Build Coastguard Worker 112*d5c09012SAndroid Build Coastguard Worker // Output only. The Recall (True Positive Rate) when only considering the 113*d5c09012SAndroid Build Coastguard Worker // label that has the highest prediction score and not below the confidence 114*d5c09012SAndroid Build Coastguard Worker // threshold for each example. 115*d5c09012SAndroid Build Coastguard Worker float recall_at1 = 5; 116*d5c09012SAndroid Build Coastguard Worker 117*d5c09012SAndroid Build Coastguard Worker // Output only. The precision when only considering the label that has the 118*d5c09012SAndroid Build Coastguard Worker // highest prediction score and not below the confidence threshold for each 119*d5c09012SAndroid Build Coastguard Worker // example. 120*d5c09012SAndroid Build Coastguard Worker float precision_at1 = 6; 121*d5c09012SAndroid Build Coastguard Worker 122*d5c09012SAndroid Build Coastguard Worker // Output only. The False Positive Rate when only considering the label that 123*d5c09012SAndroid Build Coastguard Worker // has the highest prediction score and not below the confidence threshold 124*d5c09012SAndroid Build Coastguard Worker // for each example. 125*d5c09012SAndroid Build Coastguard Worker float false_positive_rate_at1 = 9; 126*d5c09012SAndroid Build Coastguard Worker 127*d5c09012SAndroid Build Coastguard Worker // 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]. 128*d5c09012SAndroid Build Coastguard Worker float f1_score_at1 = 7; 129*d5c09012SAndroid Build Coastguard Worker 130*d5c09012SAndroid Build Coastguard Worker // Output only. The number of model created labels that match a ground truth 131*d5c09012SAndroid Build Coastguard Worker // label. 132*d5c09012SAndroid Build Coastguard Worker int64 true_positive_count = 10; 133*d5c09012SAndroid Build Coastguard Worker 134*d5c09012SAndroid Build Coastguard Worker // Output only. The number of model created labels that do not match a 135*d5c09012SAndroid Build Coastguard Worker // ground truth label. 136*d5c09012SAndroid Build Coastguard Worker int64 false_positive_count = 11; 137*d5c09012SAndroid Build Coastguard Worker 138*d5c09012SAndroid Build Coastguard Worker // Output only. The number of ground truth labels that are not matched 139*d5c09012SAndroid Build Coastguard Worker // by a model created label. 140*d5c09012SAndroid Build Coastguard Worker int64 false_negative_count = 12; 141*d5c09012SAndroid Build Coastguard Worker 142*d5c09012SAndroid Build Coastguard Worker // Output only. The number of labels that were not created by the model, 143*d5c09012SAndroid Build Coastguard Worker // but if they would, they would not match a ground truth label. 144*d5c09012SAndroid Build Coastguard Worker int64 true_negative_count = 13; 145*d5c09012SAndroid Build Coastguard Worker } 146*d5c09012SAndroid Build Coastguard Worker 147*d5c09012SAndroid Build Coastguard Worker // Confusion matrix of the model running the classification. 148*d5c09012SAndroid Build Coastguard Worker message ConfusionMatrix { 149*d5c09012SAndroid Build Coastguard Worker // Output only. A row in the confusion matrix. 150*d5c09012SAndroid Build Coastguard Worker message Row { 151*d5c09012SAndroid Build Coastguard Worker // Output only. Value of the specific cell in the confusion matrix. 152*d5c09012SAndroid Build Coastguard Worker // The number of values each row has (i.e. the length of the row) is equal 153*d5c09012SAndroid Build Coastguard Worker // to the length of the `annotation_spec_id` field or, if that one is not 154*d5c09012SAndroid Build Coastguard Worker // populated, length of the [display_name][google.cloud.automl.v1beta1.ClassificationEvaluationMetrics.ConfusionMatrix.display_name] field. 155*d5c09012SAndroid Build Coastguard Worker repeated int32 example_count = 1; 156*d5c09012SAndroid Build Coastguard Worker } 157*d5c09012SAndroid Build Coastguard Worker 158*d5c09012SAndroid Build Coastguard Worker // Output only. IDs of the annotation specs used in the confusion matrix. 159*d5c09012SAndroid Build Coastguard Worker // For Tables CLASSIFICATION 160*d5c09012SAndroid Build Coastguard Worker // 161*d5c09012SAndroid Build Coastguard Worker // [prediction_type][google.cloud.automl.v1beta1.TablesModelMetadata.prediction_type] 162*d5c09012SAndroid Build Coastguard Worker // only list of [annotation_spec_display_name-s][] is populated. 163*d5c09012SAndroid Build Coastguard Worker repeated string annotation_spec_id = 1; 164*d5c09012SAndroid Build Coastguard Worker 165*d5c09012SAndroid Build Coastguard Worker // Output only. Display name of the annotation specs used in the confusion 166*d5c09012SAndroid Build Coastguard Worker // matrix, as they were at the moment of the evaluation. For Tables 167*d5c09012SAndroid Build Coastguard Worker // CLASSIFICATION 168*d5c09012SAndroid Build Coastguard Worker // 169*d5c09012SAndroid Build Coastguard Worker // [prediction_type-s][google.cloud.automl.v1beta1.TablesModelMetadata.prediction_type], 170*d5c09012SAndroid Build Coastguard Worker // distinct values of the target column at the moment of the model 171*d5c09012SAndroid Build Coastguard Worker // evaluation are populated here. 172*d5c09012SAndroid Build Coastguard Worker repeated string display_name = 3; 173*d5c09012SAndroid Build Coastguard Worker 174*d5c09012SAndroid Build Coastguard Worker // Output only. Rows in the confusion matrix. The number of rows is equal to 175*d5c09012SAndroid Build Coastguard Worker // the size of `annotation_spec_id`. 176*d5c09012SAndroid Build Coastguard Worker // `row[i].example_count[j]` is the number of examples that have ground 177*d5c09012SAndroid Build Coastguard Worker // truth of the `annotation_spec_id[i]` and are predicted as 178*d5c09012SAndroid Build Coastguard Worker // `annotation_spec_id[j]` by the model being evaluated. 179*d5c09012SAndroid Build Coastguard Worker repeated Row row = 2; 180*d5c09012SAndroid Build Coastguard Worker } 181*d5c09012SAndroid Build Coastguard Worker 182*d5c09012SAndroid Build Coastguard Worker // Output only. The Area Under Precision-Recall Curve metric. Micro-averaged 183*d5c09012SAndroid Build Coastguard Worker // for the overall evaluation. 184*d5c09012SAndroid Build Coastguard Worker float au_prc = 1; 185*d5c09012SAndroid Build Coastguard Worker 186*d5c09012SAndroid Build Coastguard Worker // Output only. The Area Under Precision-Recall Curve metric based on priors. 187*d5c09012SAndroid Build Coastguard Worker // Micro-averaged for the overall evaluation. 188*d5c09012SAndroid Build Coastguard Worker // Deprecated. 189*d5c09012SAndroid Build Coastguard Worker float base_au_prc = 2 [deprecated = true]; 190*d5c09012SAndroid Build Coastguard Worker 191*d5c09012SAndroid Build Coastguard Worker // Output only. The Area Under Receiver Operating Characteristic curve metric. 192*d5c09012SAndroid Build Coastguard Worker // Micro-averaged for the overall evaluation. 193*d5c09012SAndroid Build Coastguard Worker float au_roc = 6; 194*d5c09012SAndroid Build Coastguard Worker 195*d5c09012SAndroid Build Coastguard Worker // Output only. The Log Loss metric. 196*d5c09012SAndroid Build Coastguard Worker float log_loss = 7; 197*d5c09012SAndroid Build Coastguard Worker 198*d5c09012SAndroid Build Coastguard Worker // Output only. Metrics for each confidence_threshold in 199*d5c09012SAndroid Build Coastguard Worker // 0.00,0.05,0.10,...,0.95,0.96,0.97,0.98,0.99 and 200*d5c09012SAndroid Build Coastguard Worker // position_threshold = INT32_MAX_VALUE. 201*d5c09012SAndroid Build Coastguard Worker // ROC and precision-recall curves, and other aggregated metrics are derived 202*d5c09012SAndroid Build Coastguard Worker // from them. The confidence metrics entries may also be supplied for 203*d5c09012SAndroid Build Coastguard Worker // additional values of position_threshold, but from these no aggregated 204*d5c09012SAndroid Build Coastguard Worker // metrics are computed. 205*d5c09012SAndroid Build Coastguard Worker repeated ConfidenceMetricsEntry confidence_metrics_entry = 3; 206*d5c09012SAndroid Build Coastguard Worker 207*d5c09012SAndroid Build Coastguard Worker // Output only. Confusion matrix of the evaluation. 208*d5c09012SAndroid Build Coastguard Worker // Only set for MULTICLASS classification problems where number 209*d5c09012SAndroid Build Coastguard Worker // of labels is no more than 10. 210*d5c09012SAndroid Build Coastguard Worker // Only set for model level evaluation, not for evaluation per label. 211*d5c09012SAndroid Build Coastguard Worker ConfusionMatrix confusion_matrix = 4; 212*d5c09012SAndroid Build Coastguard Worker 213*d5c09012SAndroid Build Coastguard Worker // Output only. The annotation spec ids used for this evaluation. 214*d5c09012SAndroid Build Coastguard Worker repeated string annotation_spec_id = 5; 215*d5c09012SAndroid Build Coastguard Worker} 216