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
15syntax = "proto3";
16
17package google.cloud.automl.v1beta1;
18
19import "google/cloud/automl/v1beta1/text_segment.proto";
20
21option go_package = "cloud.google.com/go/automl/apiv1beta1/automlpb;automlpb";
22option java_multiple_files = true;
23option java_package = "com.google.cloud.automl.v1beta1";
24option php_namespace = "Google\\Cloud\\AutoMl\\V1beta1";
25option ruby_package = "Google::Cloud::AutoML::V1beta1";
26
27// Annotation for identifying spans of text.
28message TextExtractionAnnotation {
29  // Required. Text extraction annotations can either be a text segment or a
30  // text relation.
31  oneof annotation {
32    // An entity annotation will set this, which is the part of the original
33    // text to which the annotation pertains.
34    TextSegment text_segment = 3;
35  }
36
37  // Output only. A confidence estimate between 0.0 and 1.0. A higher value
38  // means greater confidence in correctness of the annotation.
39  float score = 1;
40}
41
42// Model evaluation metrics for text extraction problems.
43message TextExtractionEvaluationMetrics {
44  // Metrics for a single confidence threshold.
45  message ConfidenceMetricsEntry {
46    // Output only. The confidence threshold value used to compute the metrics.
47    // Only annotations with score of at least this threshold are considered to
48    // be ones the model would return.
49    float confidence_threshold = 1;
50
51    // Output only. Recall under the given confidence threshold.
52    float recall = 3;
53
54    // Output only. Precision under the given confidence threshold.
55    float precision = 4;
56
57    // Output only. The harmonic mean of recall and precision.
58    float f1_score = 5;
59  }
60
61  // Output only. The Area under precision recall curve metric.
62  float au_prc = 1;
63
64  // Output only. Metrics that have confidence thresholds.
65  // Precision-recall curve can be derived from it.
66  repeated ConfidenceMetricsEntry confidence_metrics_entries = 2;
67}
68