Class: Google::Apis::AiplatformV1::GoogleCloudAiplatformV1DatasetCustomMetric

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/aiplatform_v1/classes.rb,
lib/google/apis/aiplatform_v1/representations.rb,
lib/google/apis/aiplatform_v1/representations.rb

Overview

Defines a custom dataset-level aggregation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleCloudAiplatformV1DatasetCustomMetric

Returns a new instance of GoogleCloudAiplatformV1DatasetCustomMetric.



6389
6390
6391
# File 'lib/google/apis/aiplatform_v1/classes.rb', line 6389

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#aggregation_functionString

Required. The Python code string containing the aggregation function. Expected function signature: def aggregate(instances: list[dict[str, Any]]) -> dict[ str, float]: The instances argument is a list of dictionaries, where each dictionary represents a single evaluation result item. The structure of each dictionary corresponds to the fields in the EvaluationResult message. This includes: - "request": Contains the original input data and model inputs ( from EvaluationResult.EvaluationRequest). - "candidate_results": Contains the results of any instance-level metrics (from EvaluationResult. CandidateResults). Example of a single item in the instances list: " request": "prompt": "text": "What is the capital of France?", " golden_response": "text": "Paris", "candidate_responses": ["candidate": " model-v1", "text": "Paris"] , "candidate_results": ["metric": "exact_match" , "score": 1.0,"metric": "bleu", "score": 0.9] Corresponds to the JSON property aggregationFunction

Returns:

  • (String)


6379
6380
6381
# File 'lib/google/apis/aiplatform_v1/classes.rb', line 6379

def aggregation_function
  @aggregation_function
end

#display_nameString

Optional. A display name for this custom summary metric. Used to prefix keys in the output summaryMetrics map. If not provided, a default name like " dataset_custom_metric_1", "dataset_custom_metric_2", etc., will be generated based on the order in the repeated field. Corresponds to the JSON property displayName

Returns:

  • (String)


6387
6388
6389
# File 'lib/google/apis/aiplatform_v1/classes.rb', line 6387

def display_name
  @display_name
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



6394
6395
6396
6397
# File 'lib/google/apis/aiplatform_v1/classes.rb', line 6394

def update!(**args)
  @aggregation_function = args[:aggregation_function] if args.key?(:aggregation_function)
  @display_name = args[:display_name] if args.key?(:display_name)
end