// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.aiplatform.v1beta1;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1;aiplatform";
option java_multiple_files = true;
option java_outer_classname = "ModelEvaluationSliceProto";
option java_package = "com.google.cloud.aiplatform.v1beta1";

// A collection of metrics calculated by comparing Model's predictions on a
// slice of the test data against ground truth annotations.
message ModelEvaluationSlice {
  option (google.api.resource) = {
    type: "aiplatform.googleapis.com/ModelEvaluationSlice"
    pattern: "projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}"
  };

  // Definition of a slice.
  message Slice {
    // Output only. The dimension of the slice.
    // Well-known dimensions are:
    //   * `annotationSpec`: This slice is on the test data that has either
    //     ground truth or prediction with [AnnotationSpec.display_name][google.cloud.aiplatform.v1beta1.AnnotationSpec.display_name]
    //     equals to [value][google.cloud.aiplatform.v1beta1.ModelEvaluationSlice.Slice.value].
    string dimension = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. The value of the dimension in this slice.
    string value = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // Output only. The resource name of the ModelEvaluationSlice.
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The slice of the test data that is used to evaluate the Model.
  Slice slice = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Points to a YAML file stored on Google Cloud Storage describing the
  // [metrics][google.cloud.aiplatform.v1beta1.ModelEvaluationSlice.metrics] of this ModelEvaluationSlice. The
  // schema is defined as an OpenAPI 3.0.2
  // [Schema Object](https://tinyurl.com/y538mdwt#schema-object).
  string metrics_schema_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Sliced evaluation metrics of the Model. The schema of the metrics is stored
  // in [metrics_schema_uri][google.cloud.aiplatform.v1beta1.ModelEvaluationSlice.metrics_schema_uri]
  google.protobuf.Value metrics = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Timestamp when this ModelEvaluationSlice was created.
  google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}
