xref: /aosp_15_r20/external/googleapis/google/cloud/aiplatform/v1beta1/study.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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/protobuf/duration.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 = "StudyProto";
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 message representing a Study.
35message Study {
36  option (google.api.resource) = {
37    type: "aiplatform.googleapis.com/Study"
38    pattern: "projects/{project}/locations/{location}/studies/{study}"
39  };
40
41  // Describes the Study state.
42  enum State {
43    // The study state is unspecified.
44    STATE_UNSPECIFIED = 0;
45
46    // The study is active.
47    ACTIVE = 1;
48
49    // The study is stopped due to an internal error.
50    INACTIVE = 2;
51
52    // The study is done when the service exhausts the parameter search space
53    // or max_trial_count is reached.
54    COMPLETED = 3;
55  }
56
57  // Output only. The name of a study. The study's globally unique identifier.
58  // Format: `projects/{project}/locations/{location}/studies/{study}`
59  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
60
61  // Required. Describes the Study, default value is empty string.
62  string display_name = 2 [(google.api.field_behavior) = REQUIRED];
63
64  // Required. Configuration of the Study.
65  StudySpec study_spec = 3 [(google.api.field_behavior) = REQUIRED];
66
67  // Output only. The detailed state of a Study.
68  State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
69
70  // Output only. Time at which the study was created.
71  google.protobuf.Timestamp create_time = 5
72      [(google.api.field_behavior) = OUTPUT_ONLY];
73
74  // Output only. A human readable reason why the Study is inactive.
75  // This should be empty if a study is ACTIVE or COMPLETED.
76  string inactive_reason = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
77}
78
79// A message representing a Trial. A Trial contains a unique set of Parameters
80// that has been or will be evaluated, along with the objective metrics got by
81// running the Trial.
82message Trial {
83  option (google.api.resource) = {
84    type: "aiplatform.googleapis.com/Trial"
85    pattern: "projects/{project}/locations/{location}/studies/{study}/trials/{trial}"
86  };
87
88  // A message representing a parameter to be tuned.
89  message Parameter {
90    // Output only. The ID of the parameter. The parameter should be defined in
91    // [StudySpec's
92    // Parameters][google.cloud.aiplatform.v1beta1.StudySpec.parameters].
93    string parameter_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
94
95    // Output only. The value of the parameter.
96    // `number_value` will be set if a parameter defined in StudySpec is
97    // in type 'INTEGER', 'DOUBLE' or 'DISCRETE'.
98    // `string_value` will be set if a parameter defined in StudySpec is
99    // in type 'CATEGORICAL'.
100    google.protobuf.Value value = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
101  }
102
103  // Describes a Trial state.
104  enum State {
105    // The Trial state is unspecified.
106    STATE_UNSPECIFIED = 0;
107
108    // Indicates that a specific Trial has been requested, but it has not yet
109    // been suggested by the service.
110    REQUESTED = 1;
111
112    // Indicates that the Trial has been suggested.
113    ACTIVE = 2;
114
115    // Indicates that the Trial should stop according to the service.
116    STOPPING = 3;
117
118    // Indicates that the Trial is completed successfully.
119    SUCCEEDED = 4;
120
121    // Indicates that the Trial should not be attempted again.
122    // The service will set a Trial to INFEASIBLE when it's done but missing
123    // the final_measurement.
124    INFEASIBLE = 5;
125  }
126
127  // Output only. Resource name of the Trial assigned by the service.
128  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
129
130  // Output only. The identifier of the Trial assigned by the service.
131  string id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
132
133  // Output only. The detailed state of the Trial.
134  State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
135
136  // Output only. The parameters of the Trial.
137  repeated Parameter parameters = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
138
139  // Output only. The final measurement containing the objective value.
140  Measurement final_measurement = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
141
142  // Output only. A list of measurements that are strictly lexicographically
143  // ordered by their induced tuples (steps, elapsed_duration).
144  // These are used for early stopping computations.
145  repeated Measurement measurements = 6
146      [(google.api.field_behavior) = OUTPUT_ONLY];
147
148  // Output only. Time when the Trial was started.
149  google.protobuf.Timestamp start_time = 7
150      [(google.api.field_behavior) = OUTPUT_ONLY];
151
152  // Output only. Time when the Trial's status changed to `SUCCEEDED` or
153  // `INFEASIBLE`.
154  google.protobuf.Timestamp end_time = 8
155      [(google.api.field_behavior) = OUTPUT_ONLY];
156
157  // Output only. The identifier of the client that originally requested this
158  // Trial. Each client is identified by a unique client_id. When a client asks
159  // for a suggestion, Vertex AI Vizier will assign it a Trial. The client
160  // should evaluate the Trial, complete it, and report back to Vertex AI
161  // Vizier. If suggestion is asked again by same client_id before the Trial is
162  // completed, the same Trial will be returned. Multiple clients with
163  // different client_ids can ask for suggestions simultaneously, each of them
164  // will get their own Trial.
165  string client_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
166
167  // Output only. A human readable string describing why the Trial is
168  // infeasible. This is set only if Trial state is `INFEASIBLE`.
169  string infeasible_reason = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
170
171  // Output only. The CustomJob name linked to the Trial.
172  // It's set for a HyperparameterTuningJob's Trial.
173  string custom_job = 11 [
174    (google.api.field_behavior) = OUTPUT_ONLY,
175    (google.api.resource_reference) = {
176      type: "aiplatform.googleapis.com/CustomJob"
177    }
178  ];
179
180  // Output only. URIs for accessing [interactive
181  // shells](https://cloud.google.com/vertex-ai/docs/training/monitor-debug-interactive-shell)
182  // (one URI for each training node). Only available if this trial is part of
183  // a
184  // [HyperparameterTuningJob][google.cloud.aiplatform.v1beta1.HyperparameterTuningJob]
185  // and the job's
186  // [trial_job_spec.enable_web_access][google.cloud.aiplatform.v1beta1.CustomJobSpec.enable_web_access]
187  // field is `true`.
188  //
189  // The keys are names of each node used for the trial; for example,
190  // `workerpool0-0` for the primary node, `workerpool1-0` for the first node in
191  // the second worker pool, and `workerpool1-1` for the second node in the
192  // second worker pool.
193  //
194  // The values are the URIs for each node's interactive shell.
195  map<string, string> web_access_uris = 12
196      [(google.api.field_behavior) = OUTPUT_ONLY];
197}
198
199// Next ID: 3
200message TrialContext {
201  // A human-readable field which can store a description of this context.
202  // This will become part of the resulting Trial's description field.
203  string description = 1;
204
205  // If/when a Trial is generated or selected from this Context,
206  // its Parameters will match any parameters specified here.
207  // (I.e. if this context specifies parameter name:'a' int_value:3,
208  // then a resulting Trial will have int_value:3 for its parameter named
209  // 'a'.) Note that we first attempt to match existing REQUESTED Trials with
210  // contexts, and if there are no matches, we generate suggestions in the
211  // subspace defined by the parameters specified here.
212  // NOTE: a Context without any Parameters matches the entire feasible search
213  //   space.
214  repeated Trial.Parameter parameters = 2;
215}
216
217// Time-based Constraint for Study
218message StudyTimeConstraint {
219  oneof constraint {
220    // Counts the wallclock time passed since the creation of this Study.
221    google.protobuf.Duration max_duration = 1;
222
223    // Compares the wallclock time to this time. Must use UTC timezone.
224    google.protobuf.Timestamp end_time = 2;
225  }
226}
227
228// Represents specification of a Study.
229message StudySpec {
230  // Represents a metric to optimize.
231  message MetricSpec {
232    // Used in safe optimization to specify threshold levels and risk tolerance.
233    message SafetyMetricConfig {
234      // Safety threshold (boundary value between safe and unsafe). NOTE that if
235      // you leave SafetyMetricConfig unset, a default value of 0 will be used.
236      double safety_threshold = 1;
237
238      // Desired minimum fraction of safe trials (over total number of trials)
239      // that should be targeted by the algorithm at any time during the
240      // study (best effort). This should be between 0.0 and 1.0 and a value of
241      // 0.0 means that there is no minimum and an algorithm proceeds without
242      // targeting any specific fraction. A value of 1.0 means that the
243      // algorithm attempts to only Suggest safe Trials.
244      optional double desired_min_safe_trials_fraction = 2;
245    }
246
247    // The available types of optimization goals.
248    enum GoalType {
249      // Goal Type will default to maximize.
250      GOAL_TYPE_UNSPECIFIED = 0;
251
252      // Maximize the goal metric.
253      MAXIMIZE = 1;
254
255      // Minimize the goal metric.
256      MINIMIZE = 2;
257    }
258
259    // Required. The ID of the metric. Must not contain whitespaces and must be
260    // unique amongst all MetricSpecs.
261    string metric_id = 1 [(google.api.field_behavior) = REQUIRED];
262
263    // Required. The optimization goal of the metric.
264    GoalType goal = 2 [(google.api.field_behavior) = REQUIRED];
265
266    // Used for safe search. In the case, the metric will be a safety
267    // metric. You must provide a separate metric for objective metric.
268    optional SafetyMetricConfig safety_config = 3;
269  }
270
271  // Represents a single parameter to optimize.
272  message ParameterSpec {
273    // Value specification for a parameter in `DOUBLE` type.
274    message DoubleValueSpec {
275      // Required. Inclusive minimum value of the parameter.
276      double min_value = 1 [(google.api.field_behavior) = REQUIRED];
277
278      // Required. Inclusive maximum value of the parameter.
279      double max_value = 2 [(google.api.field_behavior) = REQUIRED];
280
281      // A default value for a `DOUBLE` parameter that is assumed to be a
282      // relatively good starting point.  Unset value signals that there is no
283      // offered starting point.
284      //
285      // Currently only supported by the Vertex AI Vizier service. Not supported
286      // by HyperparameterTuningJob or TrainingPipeline.
287      optional double default_value = 4;
288    }
289
290    // Value specification for a parameter in `INTEGER` type.
291    message IntegerValueSpec {
292      // Required. Inclusive minimum value of the parameter.
293      int64 min_value = 1 [(google.api.field_behavior) = REQUIRED];
294
295      // Required. Inclusive maximum value of the parameter.
296      int64 max_value = 2 [(google.api.field_behavior) = REQUIRED];
297
298      // A default value for an `INTEGER` parameter that is assumed to be a
299      // relatively good starting point.  Unset value signals that there is no
300      // offered starting point.
301      //
302      // Currently only supported by the Vertex AI Vizier service. Not supported
303      // by HyperparameterTuningJob or TrainingPipeline.
304      optional int64 default_value = 4;
305    }
306
307    // Value specification for a parameter in `CATEGORICAL` type.
308    message CategoricalValueSpec {
309      // Required. The list of possible categories.
310      repeated string values = 1 [(google.api.field_behavior) = REQUIRED];
311
312      // A default value for a `CATEGORICAL` parameter that is assumed to be a
313      // relatively good starting point.  Unset value signals that there is no
314      // offered starting point.
315      //
316      // Currently only supported by the Vertex AI Vizier service. Not supported
317      // by HyperparameterTuningJob or TrainingPipeline.
318      optional string default_value = 3;
319    }
320
321    // Value specification for a parameter in `DISCRETE` type.
322    message DiscreteValueSpec {
323      // Required. A list of possible values.
324      // The list should be in increasing order and at least 1e-10 apart.
325      // For instance, this parameter might have possible settings of 1.5, 2.5,
326      // and 4.0. This list should not contain more than 1,000 values.
327      repeated double values = 1 [(google.api.field_behavior) = REQUIRED];
328
329      // A default value for a `DISCRETE` parameter that is assumed to be a
330      // relatively good starting point.  Unset value signals that there is no
331      // offered starting point.  It automatically rounds to the
332      // nearest feasible discrete point.
333      //
334      // Currently only supported by the Vertex AI Vizier service. Not supported
335      // by HyperparameterTuningJob or TrainingPipeline.
336      optional double default_value = 3;
337    }
338
339    // Represents a parameter spec with condition from its parent parameter.
340    message ConditionalParameterSpec {
341      // Represents the spec to match discrete values from parent parameter.
342      message DiscreteValueCondition {
343        // Required. Matches values of the parent parameter of 'DISCRETE' type.
344        // All values must exist in `discrete_value_spec` of parent parameter.
345        //
346        // The Epsilon of the value matching is 1e-10.
347        repeated double values = 1 [(google.api.field_behavior) = REQUIRED];
348      }
349
350      // Represents the spec to match integer values from parent parameter.
351      message IntValueCondition {
352        // Required. Matches values of the parent parameter of 'INTEGER' type.
353        // All values must lie in `integer_value_spec` of parent parameter.
354        repeated int64 values = 1 [(google.api.field_behavior) = REQUIRED];
355      }
356
357      // Represents the spec to match categorical values from parent parameter.
358      message CategoricalValueCondition {
359        // Required. Matches values of the parent parameter of 'CATEGORICAL'
360        // type. All values must exist in `categorical_value_spec` of parent
361        // parameter.
362        repeated string values = 1 [(google.api.field_behavior) = REQUIRED];
363      }
364
365      // A set of parameter values from the parent ParameterSpec's feasible
366      // space.
367      oneof parent_value_condition {
368        // The spec for matching values from a parent parameter of
369        // `DISCRETE` type.
370        DiscreteValueCondition parent_discrete_values = 2;
371
372        // The spec for matching values from a parent parameter of `INTEGER`
373        // type.
374        IntValueCondition parent_int_values = 3;
375
376        // The spec for matching values from a parent parameter of
377        // `CATEGORICAL` type.
378        CategoricalValueCondition parent_categorical_values = 4;
379      }
380
381      // Required. The spec for a conditional parameter.
382      ParameterSpec parameter_spec = 1 [(google.api.field_behavior) = REQUIRED];
383    }
384
385    // The type of scaling that should be applied to this parameter.
386    enum ScaleType {
387      // By default, no scaling is applied.
388      SCALE_TYPE_UNSPECIFIED = 0;
389
390      // Scales the feasible space to (0, 1) linearly.
391      UNIT_LINEAR_SCALE = 1;
392
393      // Scales the feasible space logarithmically to (0, 1). The entire
394      // feasible space must be strictly positive.
395      UNIT_LOG_SCALE = 2;
396
397      // Scales the feasible space "reverse" logarithmically to (0, 1). The
398      // result is that values close to the top of the feasible space are spread
399      // out more than points near the bottom. The entire feasible space must be
400      // strictly positive.
401      UNIT_REVERSE_LOG_SCALE = 3;
402    }
403
404    oneof parameter_value_spec {
405      // The value spec for a 'DOUBLE' parameter.
406      DoubleValueSpec double_value_spec = 2;
407
408      // The value spec for an 'INTEGER' parameter.
409      IntegerValueSpec integer_value_spec = 3;
410
411      // The value spec for a 'CATEGORICAL' parameter.
412      CategoricalValueSpec categorical_value_spec = 4;
413
414      // The value spec for a 'DISCRETE' parameter.
415      DiscreteValueSpec discrete_value_spec = 5;
416    }
417
418    // Required. The ID of the parameter. Must not contain whitespaces and must
419    // be unique amongst all ParameterSpecs.
420    string parameter_id = 1 [(google.api.field_behavior) = REQUIRED];
421
422    // How the parameter should be scaled.
423    // Leave unset for `CATEGORICAL` parameters.
424    ScaleType scale_type = 6;
425
426    // A conditional parameter node is active if the parameter's value matches
427    // the conditional node's parent_value_condition.
428    //
429    // If two items in conditional_parameter_specs have the same name, they
430    // must have disjoint parent_value_condition.
431    repeated ConditionalParameterSpec conditional_parameter_specs = 10;
432  }
433
434  // The decay curve automated stopping rule builds a Gaussian Process
435  // Regressor to predict the final objective value of a Trial based on the
436  // already completed Trials and the intermediate measurements of the current
437  // Trial. Early stopping is requested for the current Trial if there is very
438  // low probability to exceed the optimal value found so far.
439  message DecayCurveAutomatedStoppingSpec {
440    // True if
441    // [Measurement.elapsed_duration][google.cloud.aiplatform.v1beta1.Measurement.elapsed_duration]
442    // is used as the x-axis of each Trials Decay Curve. Otherwise,
443    // [Measurement.step_count][google.cloud.aiplatform.v1beta1.Measurement.step_count]
444    // will be used as the x-axis.
445    bool use_elapsed_duration = 1;
446  }
447
448  // The median automated stopping rule stops a pending Trial if the Trial's
449  // best objective_value is strictly below the median 'performance' of all
450  // completed Trials reported up to the Trial's last measurement.
451  // Currently, 'performance' refers to the running average of the objective
452  // values reported by the Trial in each measurement.
453  message MedianAutomatedStoppingSpec {
454    // True if median automated stopping rule applies on
455    // [Measurement.elapsed_duration][google.cloud.aiplatform.v1beta1.Measurement.elapsed_duration].
456    // It means that elapsed_duration field of latest measurement of current
457    // Trial is used to compute median objective value for each completed
458    // Trials.
459    bool use_elapsed_duration = 1;
460  }
461
462  // Configuration for ConvexAutomatedStoppingSpec.
463  // When there are enough completed trials (configured by
464  // min_measurement_count), for pending trials with enough measurements and
465  // steps, the policy first computes an overestimate of the objective value at
466  // max_num_steps according to the slope of the incomplete objective value
467  // curve. No prediction can be made if the curve is completely flat. If the
468  // overestimation is worse than the best objective value of the completed
469  // trials, this pending trial will be early-stopped, but a last measurement
470  // will be added to the pending trial with max_num_steps and predicted
471  // objective value from the autoregression model.
472  message ConvexAutomatedStoppingSpec {
473    // Steps used in predicting the final objective for early stopped trials. In
474    // general, it's set to be the same as the defined steps in training /
475    // tuning. If not defined, it will learn it from the completed trials. When
476    // use_steps is false, this field is set to the maximum elapsed seconds.
477    int64 max_step_count = 1;
478
479    // Minimum number of steps for a trial to complete. Trials which do not have
480    // a measurement with step_count > min_step_count won't be considered for
481    // early stopping. It's ok to set it to 0, and a trial can be early stopped
482    // at any stage. By default, min_step_count is set to be one-tenth of the
483    // max_step_count.
484    // When use_elapsed_duration is true, this field is set to the minimum
485    // elapsed seconds.
486    int64 min_step_count = 2;
487
488    // The minimal number of measurements in a Trial.  Early-stopping checks
489    // will not trigger if less than min_measurement_count+1 completed trials or
490    // pending trials with less than min_measurement_count measurements. If not
491    // defined, the default value is 5.
492    int64 min_measurement_count = 3;
493
494    // The hyper-parameter name used in the tuning job that stands for learning
495    // rate. Leave it blank if learning rate is not in a parameter in tuning.
496    // The learning_rate is used to estimate the objective value of the ongoing
497    // trial.
498    string learning_rate_parameter_name = 4;
499
500    // This bool determines whether or not the rule is applied based on
501    // elapsed_secs or steps. If use_elapsed_duration==false, the early stopping
502    // decision is made according to the predicted objective values according to
503    // the target steps. If use_elapsed_duration==true, elapsed_secs is used
504    // instead of steps. Also, in this case, the parameters max_num_steps and
505    // min_num_steps are overloaded to contain max_elapsed_seconds and
506    // min_elapsed_seconds.
507    bool use_elapsed_duration = 5;
508
509    // ConvexAutomatedStoppingSpec by default only updates the trials that needs
510    // to be early stopped using a newly trained auto-regressive model. When
511    // this flag is set to True, all stopped trials from the beginning are
512    // potentially updated in terms of their `final_measurement`. Also, note
513    // that the training logic of autoregressive models is different in this
514    // case. Enabling this option has shown better results and this may be the
515    // default option in the future.
516    optional bool update_all_stopped_trials = 6;
517  }
518
519  // Configuration for ConvexStopPolicy.
520  message ConvexStopConfig {
521    option deprecated = true;
522
523    // Steps used in predicting the final objective for early stopped trials. In
524    // general, it's set to be the same as the defined steps in training /
525    // tuning. When use_steps is false, this field is set to the maximum elapsed
526    // seconds.
527    int64 max_num_steps = 1;
528
529    // Minimum number of steps for a trial to complete. Trials which do not have
530    // a measurement with num_steps > min_num_steps won't be considered for
531    // early stopping. It's ok to set it to 0, and a trial can be early stopped
532    // at any stage. By default, min_num_steps is set to be one-tenth of the
533    // max_num_steps.
534    // When use_steps is false, this field is set to the minimum elapsed
535    // seconds.
536    int64 min_num_steps = 2;
537
538    // The number of Trial measurements used in autoregressive model for
539    // value prediction. A trial won't be considered early stopping if has fewer
540    // measurement points.
541    int64 autoregressive_order = 3;
542
543    // The hyper-parameter name used in the tuning job that stands for learning
544    // rate. Leave it blank if learning rate is not in a parameter in tuning.
545    // The learning_rate is used to estimate the objective value of the ongoing
546    // trial.
547    string learning_rate_parameter_name = 4;
548
549    // This bool determines whether or not the rule is applied based on
550    // elapsed_secs or steps. If use_seconds==false, the early stopping decision
551    // is made according to the predicted objective values according to the
552    // target steps. If use_seconds==true, elapsed_secs is used instead of
553    // steps. Also, in this case, the parameters max_num_steps and min_num_steps
554    // are overloaded to contain max_elapsed_seconds and min_elapsed_seconds.
555    bool use_seconds = 5;
556  }
557
558  // This contains flag for manually disabling transfer learning for a study.
559  // The names of prior studies being used for transfer learning (if any)
560  // are also listed here.
561  message TransferLearningConfig {
562    // Flag to to manually prevent vizier from using transfer learning on a
563    // new study. Otherwise, vizier will automatically determine whether or not
564    // to use transfer learning.
565    bool disable_transfer_learning = 1;
566
567    // Output only. Names of previously completed studies
568    repeated string prior_study_names = 2
569        [(google.api.field_behavior) = OUTPUT_ONLY];
570  }
571
572  // The configuration (stopping conditions) for automated stopping of a Study.
573  // Conditions include trial budgets, time budgets, and convergence detection.
574  message StudyStoppingConfig {
575    // If true, a Study enters STOPPING_ASAP whenever it would normally enters
576    // STOPPING state.
577    //
578    // The bottom line is: set to true if you want to interrupt on-going
579    // evaluations of Trials as soon as the study stopping condition is met.
580    // (Please see Study.State documentation for the source of truth).
581    google.protobuf.BoolValue should_stop_asap = 1;
582
583    // Each "stopping rule" in this proto specifies an "if" condition. Before
584    // Vizier would generate a new suggestion, it first checks each specified
585    // stopping rule, from top to bottom in this list.
586    // Note that the first few rules (e.g. minimum_runtime_constraint,
587    // min_num_trials) will prevent other stopping rules from being evaluated
588    // until they are met. For example, setting `min_num_trials=5` and
589    // `always_stop_after= 1 hour` means that the Study will ONLY stop after it
590    // has 5 COMPLETED trials, even if more than an hour has passed since its
591    // creation. It follows the first applicable rule (whose "if" condition is
592    // satisfied) to make a stopping decision. If none of the specified rules
593    // are applicable, then Vizier decides that the study should not stop.
594    // If Vizier decides that the study should stop, the study enters
595    // STOPPING state (or STOPPING_ASAP if should_stop_asap = true).
596    // IMPORTANT: The automatic study state transition happens precisely as
597    // described above; that is, deleting trials or updating StudyConfig NEVER
598    // automatically moves the study state back to ACTIVE. If you want to
599    // _resume_ a Study that was stopped, 1) change the stopping conditions if
600    // necessary, 2) activate the study, and then 3) ask for suggestions.
601    // If the specified time or duration has not passed, do not stop the
602    // study.
603    StudyTimeConstraint minimum_runtime_constraint = 2;
604
605    // If the specified time or duration has passed, stop the study.
606    StudyTimeConstraint maximum_runtime_constraint = 3;
607
608    // If there are fewer than this many COMPLETED trials, do not stop the
609    // study.
610    google.protobuf.Int32Value min_num_trials = 4;
611
612    // If there are more than this many trials, stop the study.
613    google.protobuf.Int32Value max_num_trials = 5;
614
615    // If the objective value has not improved for this many consecutive
616    // trials, stop the study.
617    //
618    // WARNING: Effective only for single-objective studies.
619    google.protobuf.Int32Value max_num_trials_no_progress = 6;
620
621    // If the objective value has not improved for this much time, stop the
622    // study.
623    //
624    // WARNING: Effective only for single-objective studies.
625    google.protobuf.Duration max_duration_no_progress = 7;
626  }
627
628  // The available search algorithms for the Study.
629  enum Algorithm {
630    // The default algorithm used by Vertex AI for [hyperparameter
631    // tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
632    // and [Vertex AI Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
633    ALGORITHM_UNSPECIFIED = 0;
634
635    // Simple grid search within the feasible space. To use grid search,
636    // all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
637    GRID_SEARCH = 2;
638
639    // Simple random search within the feasible space.
640    RANDOM_SEARCH = 3;
641  }
642
643  // Describes the noise level of the repeated observations.
644  //
645  // "Noisy" means that the repeated observations with the same Trial parameters
646  // may lead to different metric evaluations.
647  enum ObservationNoise {
648    // The default noise level chosen by Vertex AI.
649    OBSERVATION_NOISE_UNSPECIFIED = 0;
650
651    // Vertex AI assumes that the objective function is (nearly)
652    // perfectly reproducible, and will never repeat the same Trial
653    // parameters.
654    LOW = 1;
655
656    // Vertex AI will estimate the amount of noise in metric
657    // evaluations, it may repeat the same Trial parameters more than once.
658    HIGH = 2;
659  }
660
661  // This indicates which measurement to use if/when the service automatically
662  // selects the final measurement from previously reported intermediate
663  // measurements. Choose this based on two considerations:
664  //  A) Do you expect your measurements to monotonically improve?
665  //     If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
666  //     situation where your system can "over-train" and you expect the
667  //     performance to get better for a while but then start declining,
668  //     choose BEST_MEASUREMENT.
669  //  B) Are your measurements significantly noisy and/or irreproducible?
670  //     If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
671  //     may be better to choose LAST_MEASUREMENT.
672  //  If both or neither of (A) and (B) apply, it doesn't matter which
673  //  selection type is chosen.
674  enum MeasurementSelectionType {
675    // Will be treated as LAST_MEASUREMENT.
676    MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0;
677
678    // Use the last measurement reported.
679    LAST_MEASUREMENT = 1;
680
681    // Use the best measurement reported.
682    BEST_MEASUREMENT = 2;
683  }
684
685  oneof automated_stopping_spec {
686    // The automated early stopping spec using decay curve rule.
687    DecayCurveAutomatedStoppingSpec decay_curve_stopping_spec = 4;
688
689    // The automated early stopping spec using median rule.
690    MedianAutomatedStoppingSpec median_automated_stopping_spec = 5;
691
692    // Deprecated.
693    // The automated early stopping using convex stopping rule.
694    ConvexStopConfig convex_stop_config = 8 [deprecated = true];
695
696    // The automated early stopping spec using convex stopping rule.
697    ConvexAutomatedStoppingSpec convex_automated_stopping_spec = 9;
698  }
699
700  // Required. Metric specs for the Study.
701  repeated MetricSpec metrics = 1 [(google.api.field_behavior) = REQUIRED];
702
703  // Required. The set of parameters to tune.
704  repeated ParameterSpec parameters = 2
705      [(google.api.field_behavior) = REQUIRED];
706
707  // The search algorithm specified for the Study.
708  Algorithm algorithm = 3;
709
710  // The observation noise level of the study.
711  // Currently only supported by the Vertex AI Vizier service. Not supported by
712  // HyperparameterTuningJob or TrainingPipeline.
713  ObservationNoise observation_noise = 6;
714
715  // Describe which measurement selection type will be used
716  MeasurementSelectionType measurement_selection_type = 7;
717
718  // The configuration info/options for transfer learning. Currently supported
719  // for Vertex AI Vizier service, not HyperParameterTuningJob
720  TransferLearningConfig transfer_learning_config = 10;
721
722  // Conditions for automated stopping of a Study. Enable automated stopping by
723  // configuring at least one condition.
724  optional StudyStoppingConfig study_stopping_config = 11;
725}
726
727// A message representing a Measurement of a Trial. A Measurement contains
728// the Metrics got by executing a Trial using suggested hyperparameter
729// values.
730message Measurement {
731  // A message representing a metric in the measurement.
732  message Metric {
733    // Output only. The ID of the Metric. The Metric should be defined in
734    // [StudySpec's Metrics][google.cloud.aiplatform.v1beta1.StudySpec.metrics].
735    string metric_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
736
737    // Output only. The value for this metric.
738    double value = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
739  }
740
741  // Output only. Time that the Trial has been running at the point of this
742  // Measurement.
743  google.protobuf.Duration elapsed_duration = 1
744      [(google.api.field_behavior) = OUTPUT_ONLY];
745
746  // Output only. The number of steps the machine learning model has been
747  // trained for. Must be non-negative.
748  int64 step_count = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
749
750  // Output only. A list of metrics got by evaluating the objective functions
751  // using suggested Parameter values.
752  repeated Metric metrics = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
753}
754