• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2023 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.aiplatform.v1beta1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/aiplatform/v1beta1/explanation.proto";
22import "google/protobuf/struct.proto";
23import "google/protobuf/timestamp.proto";
24import "google/protobuf/wrappers.proto";
25
26option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
27option go_package = "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb;aiplatformpb";
28option java_multiple_files = true;
29option java_outer_classname = "ModelEvaluationSliceProto";
30option java_package = "com.google.cloud.aiplatform.v1beta1";
31option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
32option ruby_package = "Google::Cloud::AIPlatform::V1beta1";
33
34// A collection of metrics calculated by comparing Model's predictions on a
35// slice of the test data against ground truth annotations.
36message ModelEvaluationSlice {
37  option (google.api.resource) = {
38    type: "aiplatform.googleapis.com/ModelEvaluationSlice"
39    pattern: "projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}"
40  };
41
42  // Definition of a slice.
43  message Slice {
44    // Specification for how the data should be sliced.
45    message SliceSpec {
46      // Specification message containing the config for this SliceSpec.
47      // When `kind` is selected as `value` and/or `range`, only a single slice
48      // will be computed.
49      // When `all_values` is present, a separate slice will be computed for
50      // each possible label/value for the corresponding key in `config`.
51      // Examples, with feature zip_code with values 12345, 23334, 88888 and
52      // feature country with values "US", "Canada", "Mexico" in the dataset:
53      //
54      // Example 1:
55      //
56      //     {
57      //       "zip_code": { "value": { "float_value": 12345.0 } }
58      //     }
59      //
60      // A single slice for any data with zip_code 12345 in the dataset.
61      //
62      // Example 2:
63      //
64      //     {
65      //       "zip_code": { "range": { "low": 12345, "high": 20000 } }
66      //     }
67      //
68      // A single slice containing data where the zip_codes between 12345 and
69      // 20000 For this example, data with the zip_code of 12345 will be in this
70      // slice.
71      //
72      // Example 3:
73      //
74      //     {
75      //       "zip_code": { "range": { "low": 10000, "high": 20000 } },
76      //       "country": { "value": { "string_value": "US" } }
77      //     }
78      //
79      // A single slice containing data where the zip_codes between 10000 and
80      // 20000 has the country "US". For this example, data with the zip_code of
81      // 12345 and country "US" will be in this slice.
82      //
83      // Example 4:
84      //
85      //     { "country": {"all_values": { "value": true } } }
86      //
87      // Three slices are computed, one for each unique country in the dataset.
88      //
89      // Example 5:
90      //
91      //     {
92      //       "country": { "all_values": { "value": true } },
93      //       "zip_code": { "value": { "float_value": 12345.0 } }
94      //     }
95      //
96      // Three slices are computed, one for each unique country in the dataset
97      // where the zip_code is also 12345. For this example, data with zip_code
98      // 12345 and country "US" will be in one slice, zip_code 12345 and country
99      // "Canada" in another slice, and zip_code 12345 and country "Mexico" in
100      // another slice, totaling 3 slices.
101      message SliceConfig {
102        oneof kind {
103          // A unique specific value for a given feature.
104          // Example: `{ "value": { "string_value": "12345" } }`
105          Value value = 1;
106
107          // A range of values for a numerical feature.
108          // Example: `{"range":{"low":10000.0,"high":50000.0}}`
109          // will capture 12345 and 23334 in the slice.
110          Range range = 2;
111
112          // If all_values is set to true, then all possible labels of the keyed
113          // feature will have another slice computed.
114          // Example: `{"all_values":{"value":true}}`
115          google.protobuf.BoolValue all_values = 3;
116        }
117      }
118
119      // A range of values for slice(s).
120      // `low` is inclusive, `high` is exclusive.
121      message Range {
122        // Inclusive low value for the range.
123        float low = 1;
124
125        // Exclusive high value for the range.
126        float high = 2;
127      }
128
129      // Single value that supports strings and floats.
130      message Value {
131        oneof kind {
132          // String type.
133          string string_value = 1;
134
135          // Float type.
136          float float_value = 2;
137        }
138      }
139
140      // Mapping configuration for this SliceSpec.
141      // The key is the name of the feature.
142      // By default, the key will be prefixed by "instance" as a dictionary
143      // prefix for Vertex Batch Predictions output format.
144      map<string, SliceConfig> configs = 1;
145    }
146
147    // Output only. The dimension of the slice.
148    // Well-known dimensions are:
149    //   * `annotationSpec`: This slice is on the test data that has either
150    //     ground truth or prediction with
151    //     [AnnotationSpec.display_name][google.cloud.aiplatform.v1beta1.AnnotationSpec.display_name]
152    //     equals to
153    //     [value][google.cloud.aiplatform.v1beta1.ModelEvaluationSlice.Slice.value].
154    //   * `slice`: This slice is a user customized slice defined by its
155    //     SliceSpec.
156    string dimension = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
157
158    // Output only. The value of the dimension in this slice.
159    string value = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
160
161    // Output only. Specification for how the data was sliced.
162    SliceSpec slice_spec = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
163  }
164
165  // Output only. The resource name of the ModelEvaluationSlice.
166  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
167
168  // Output only. The slice of the test data that is used to evaluate the Model.
169  Slice slice = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
170
171  // Output only. Points to a YAML file stored on Google Cloud Storage
172  // describing the
173  // [metrics][google.cloud.aiplatform.v1beta1.ModelEvaluationSlice.metrics] of
174  // this ModelEvaluationSlice. The schema is defined as an OpenAPI 3.0.2
175  // [Schema
176  // Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject).
177  string metrics_schema_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
178
179  // Output only. Sliced evaluation metrics of the Model. The schema of the
180  // metrics is stored in
181  // [metrics_schema_uri][google.cloud.aiplatform.v1beta1.ModelEvaluationSlice.metrics_schema_uri]
182  google.protobuf.Value metrics = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
183
184  // Output only. Timestamp when this ModelEvaluationSlice was created.
185  google.protobuf.Timestamp create_time = 5
186      [(google.api.field_behavior) = OUTPUT_ONLY];
187
188  // Output only. Aggregated explanation metrics for the Model's prediction
189  // output over the data this ModelEvaluation uses. This field is populated
190  // only if the Model is evaluated with explanations, and only for tabular
191  // Models.
192  ModelExplanation model_explanation = 6
193      [(google.api.field_behavior) = OUTPUT_ONLY];
194}
195