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