study.proto 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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. syntax = "proto3";
  15. package google.cloud.aiplatform.v1beta1;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/protobuf/duration.proto";
  19. import "google/protobuf/struct.proto";
  20. import "google/protobuf/timestamp.proto";
  21. import "google/api/annotations.proto";
  22. option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1;aiplatform";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "StudyProto";
  26. option java_package = "com.google.cloud.aiplatform.v1beta1";
  27. option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
  28. option ruby_package = "Google::Cloud::AIPlatform::V1beta1";
  29. // A message representing a Study.
  30. message Study {
  31. option (google.api.resource) = {
  32. type: "aiplatform.googleapis.com/Study"
  33. pattern: "projects/{project}/locations/{location}/studies/{study}"
  34. };
  35. // Describes the Study state.
  36. enum State {
  37. // The study state is unspecified.
  38. STATE_UNSPECIFIED = 0;
  39. // The study is active.
  40. ACTIVE = 1;
  41. // The study is stopped due to an internal error.
  42. INACTIVE = 2;
  43. // The study is done when the service exhausts the parameter search space
  44. // or max_trial_count is reached.
  45. COMPLETED = 3;
  46. }
  47. // Output only. The name of a study. The study's globally unique identifier.
  48. // Format: `projects/{project}/locations/{location}/studies/{study}`
  49. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  50. // Required. Describes the Study, default value is empty string.
  51. string display_name = 2 [(google.api.field_behavior) = REQUIRED];
  52. // Required. Configuration of the Study.
  53. StudySpec study_spec = 3 [(google.api.field_behavior) = REQUIRED];
  54. // Output only. The detailed state of a Study.
  55. State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  56. // Output only. Time at which the study was created.
  57. google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  58. // Output only. A human readable reason why the Study is inactive.
  59. // This should be empty if a study is ACTIVE or COMPLETED.
  60. string inactive_reason = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  61. }
  62. // A message representing a Trial. A Trial contains a unique set of Parameters
  63. // that has been or will be evaluated, along with the objective metrics got by
  64. // running the Trial.
  65. message Trial {
  66. option (google.api.resource) = {
  67. type: "aiplatform.googleapis.com/Trial"
  68. pattern: "projects/{project}/locations/{location}/studies/{study}/trials/{trial}"
  69. };
  70. // A message representing a parameter to be tuned.
  71. message Parameter {
  72. // Output only. The ID of the parameter. The parameter should be defined in
  73. // [StudySpec's Parameters][google.cloud.aiplatform.v1beta1.StudySpec.parameters].
  74. string parameter_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  75. // Output only. The value of the parameter.
  76. // `number_value` will be set if a parameter defined in StudySpec is
  77. // in type 'INTEGER', 'DOUBLE' or 'DISCRETE'.
  78. // `string_value` will be set if a parameter defined in StudySpec is
  79. // in type 'CATEGORICAL'.
  80. google.protobuf.Value value = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  81. }
  82. // Describes a Trial state.
  83. enum State {
  84. // The Trial state is unspecified.
  85. STATE_UNSPECIFIED = 0;
  86. // Indicates that a specific Trial has been requested, but it has not yet
  87. // been suggested by the service.
  88. REQUESTED = 1;
  89. // Indicates that the Trial has been suggested.
  90. ACTIVE = 2;
  91. // Indicates that the Trial should stop according to the service.
  92. STOPPING = 3;
  93. // Indicates that the Trial is completed successfully.
  94. SUCCEEDED = 4;
  95. // Indicates that the Trial should not be attempted again.
  96. // The service will set a Trial to INFEASIBLE when it's done but missing
  97. // the final_measurement.
  98. INFEASIBLE = 5;
  99. }
  100. // Output only. Resource name of the Trial assigned by the service.
  101. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  102. // Output only. The identifier of the Trial assigned by the service.
  103. string id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  104. // Output only. The detailed state of the Trial.
  105. State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  106. // Output only. The parameters of the Trial.
  107. repeated Parameter parameters = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  108. // Output only. The final measurement containing the objective value.
  109. Measurement final_measurement = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  110. // Output only. A list of measurements that are strictly lexicographically
  111. // ordered by their induced tuples (steps, elapsed_duration).
  112. // These are used for early stopping computations.
  113. repeated Measurement measurements = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  114. // Output only. Time when the Trial was started.
  115. google.protobuf.Timestamp start_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  116. // Output only. Time when the Trial's status changed to `SUCCEEDED` or `INFEASIBLE`.
  117. google.protobuf.Timestamp end_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
  118. // Output only. The identifier of the client that originally requested this Trial.
  119. // Each client is identified by a unique client_id. When a client
  120. // asks for a suggestion, Vizier will assign it a Trial. The client should
  121. // evaluate the Trial, complete it, and report back to Vizier.
  122. // If suggestion is asked again by same client_id before the Trial is
  123. // completed, the same Trial will be returned. Multiple clients with
  124. // different client_ids can ask for suggestions simultaneously, each of them
  125. // will get their own Trial.
  126. string client_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
  127. // Output only. A human readable string describing why the Trial is
  128. // infeasible. This is set only if Trial state is `INFEASIBLE`.
  129. string infeasible_reason = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
  130. // Output only. The CustomJob name linked to the Trial.
  131. // It's set for a HyperparameterTuningJob's Trial.
  132. string custom_job = 11 [
  133. (google.api.field_behavior) = OUTPUT_ONLY,
  134. (google.api.resource_reference) = {
  135. type: "aiplatform.googleapis.com/CustomJob"
  136. }
  137. ];
  138. // Output only. The web access URIs for the training job.
  139. // The keys are the node names in the training jobs, e.g. workerpool0-0.
  140. // The values are the URIs for each node's web portal in the job.
  141. map<string, string> web_access_uris = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
  142. }
  143. // Represents specification of a Study.
  144. message StudySpec {
  145. // Represents a metric to optimize.
  146. message MetricSpec {
  147. // The available types of optimization goals.
  148. enum GoalType {
  149. // Goal Type will default to maximize.
  150. GOAL_TYPE_UNSPECIFIED = 0;
  151. // Maximize the goal metric.
  152. MAXIMIZE = 1;
  153. // Minimize the goal metric.
  154. MINIMIZE = 2;
  155. }
  156. // Required. The ID of the metric. Must not contain whitespaces and must be unique
  157. // amongst all MetricSpecs.
  158. string metric_id = 1 [(google.api.field_behavior) = REQUIRED];
  159. // Required. The optimization goal of the metric.
  160. GoalType goal = 2 [(google.api.field_behavior) = REQUIRED];
  161. }
  162. // Represents a single parameter to optimize.
  163. message ParameterSpec {
  164. // Value specification for a parameter in `DOUBLE` type.
  165. message DoubleValueSpec {
  166. // Required. Inclusive minimum value of the parameter.
  167. double min_value = 1 [(google.api.field_behavior) = REQUIRED];
  168. // Required. Inclusive maximum value of the parameter.
  169. double max_value = 2 [(google.api.field_behavior) = REQUIRED];
  170. // A default value for a `DOUBLE` parameter that is assumed to be a
  171. // relatively good starting point. Unset value signals that there is no
  172. // offered starting point.
  173. //
  174. // Currently only supported by the Vizier service. Not supported by
  175. // HyperparamterTuningJob or TrainingPipeline.
  176. optional double default_value = 4;
  177. }
  178. // Value specification for a parameter in `INTEGER` type.
  179. message IntegerValueSpec {
  180. // Required. Inclusive minimum value of the parameter.
  181. int64 min_value = 1 [(google.api.field_behavior) = REQUIRED];
  182. // Required. Inclusive maximum value of the parameter.
  183. int64 max_value = 2 [(google.api.field_behavior) = REQUIRED];
  184. // A default value for an `INTEGER` parameter that is assumed to be a
  185. // relatively good starting point. Unset value signals that there is no
  186. // offered starting point.
  187. //
  188. // Currently only supported by the Vizier service. Not supported by
  189. // HyperparamterTuningJob or TrainingPipeline.
  190. optional int64 default_value = 4;
  191. }
  192. // Value specification for a parameter in `CATEGORICAL` type.
  193. message CategoricalValueSpec {
  194. // Required. The list of possible categories.
  195. repeated string values = 1 [(google.api.field_behavior) = REQUIRED];
  196. // A default value for a `CATEGORICAL` parameter that is assumed to be a
  197. // relatively good starting point. Unset value signals that there is no
  198. // offered starting point.
  199. //
  200. // Currently only supported by the Vizier service. Not supported by
  201. // HyperparamterTuningJob or TrainingPipeline.
  202. optional string default_value = 3;
  203. }
  204. // Value specification for a parameter in `DISCRETE` type.
  205. message DiscreteValueSpec {
  206. // Required. A list of possible values.
  207. // The list should be in increasing order and at least 1e-10 apart.
  208. // For instance, this parameter might have possible settings of 1.5, 2.5,
  209. // and 4.0. This list should not contain more than 1,000 values.
  210. repeated double values = 1 [(google.api.field_behavior) = REQUIRED];
  211. // A default value for a `DISCRETE` parameter that is assumed to be a
  212. // relatively good starting point. Unset value signals that there is no
  213. // offered starting point. It automatically rounds to the
  214. // nearest feasible discrete point.
  215. //
  216. // Currently only supported by the Vizier service. Not supported by
  217. // HyperparamterTuningJob or TrainingPipeline.
  218. optional double default_value = 3;
  219. }
  220. // Represents a parameter spec with condition from its parent parameter.
  221. message ConditionalParameterSpec {
  222. // Represents the spec to match discrete values from parent parameter.
  223. message DiscreteValueCondition {
  224. // Required. Matches values of the parent parameter of 'DISCRETE' type.
  225. // All values must exist in `discrete_value_spec` of parent parameter.
  226. //
  227. // The Epsilon of the value matching is 1e-10.
  228. repeated double values = 1 [(google.api.field_behavior) = REQUIRED];
  229. }
  230. // Represents the spec to match integer values from parent parameter.
  231. message IntValueCondition {
  232. // Required. Matches values of the parent parameter of 'INTEGER' type.
  233. // All values must lie in `integer_value_spec` of parent parameter.
  234. repeated int64 values = 1 [(google.api.field_behavior) = REQUIRED];
  235. }
  236. // Represents the spec to match categorical values from parent parameter.
  237. message CategoricalValueCondition {
  238. // Required. Matches values of the parent parameter of 'CATEGORICAL' type.
  239. // All values must exist in `categorical_value_spec` of parent
  240. // parameter.
  241. repeated string values = 1 [(google.api.field_behavior) = REQUIRED];
  242. }
  243. // A set of parameter values from the parent ParameterSpec's feasible
  244. // space.
  245. oneof parent_value_condition {
  246. // The spec for matching values from a parent parameter of
  247. // `DISCRETE` type.
  248. DiscreteValueCondition parent_discrete_values = 2;
  249. // The spec for matching values from a parent parameter of `INTEGER`
  250. // type.
  251. IntValueCondition parent_int_values = 3;
  252. // The spec for matching values from a parent parameter of
  253. // `CATEGORICAL` type.
  254. CategoricalValueCondition parent_categorical_values = 4;
  255. }
  256. // Required. The spec for a conditional parameter.
  257. ParameterSpec parameter_spec = 1 [(google.api.field_behavior) = REQUIRED];
  258. }
  259. // The type of scaling that should be applied to this parameter.
  260. enum ScaleType {
  261. // By default, no scaling is applied.
  262. SCALE_TYPE_UNSPECIFIED = 0;
  263. // Scales the feasible space to (0, 1) linearly.
  264. UNIT_LINEAR_SCALE = 1;
  265. // Scales the feasible space logarithmically to (0, 1). The entire
  266. // feasible space must be strictly positive.
  267. UNIT_LOG_SCALE = 2;
  268. // Scales the feasible space "reverse" logarithmically to (0, 1). The
  269. // result is that values close to the top of the feasible space are spread
  270. // out more than points near the bottom. The entire feasible space must be
  271. // strictly positive.
  272. UNIT_REVERSE_LOG_SCALE = 3;
  273. }
  274. oneof parameter_value_spec {
  275. // The value spec for a 'DOUBLE' parameter.
  276. DoubleValueSpec double_value_spec = 2;
  277. // The value spec for an 'INTEGER' parameter.
  278. IntegerValueSpec integer_value_spec = 3;
  279. // The value spec for a 'CATEGORICAL' parameter.
  280. CategoricalValueSpec categorical_value_spec = 4;
  281. // The value spec for a 'DISCRETE' parameter.
  282. DiscreteValueSpec discrete_value_spec = 5;
  283. }
  284. // Required. The ID of the parameter. Must not contain whitespaces and must be unique
  285. // amongst all ParameterSpecs.
  286. string parameter_id = 1 [(google.api.field_behavior) = REQUIRED];
  287. // How the parameter should be scaled.
  288. // Leave unset for `CATEGORICAL` parameters.
  289. ScaleType scale_type = 6;
  290. // A conditional parameter node is active if the parameter's value matches
  291. // the conditional node's parent_value_condition.
  292. //
  293. // If two items in conditional_parameter_specs have the same name, they
  294. // must have disjoint parent_value_condition.
  295. repeated ConditionalParameterSpec conditional_parameter_specs = 10;
  296. }
  297. // The decay curve automated stopping rule builds a Gaussian Process
  298. // Regressor to predict the final objective value of a Trial based on the
  299. // already completed Trials and the intermediate measurements of the current
  300. // Trial. Early stopping is requested for the current Trial if there is very
  301. // low probability to exceed the optimal value found so far.
  302. message DecayCurveAutomatedStoppingSpec {
  303. // True if [Measurement.elapsed_duration][google.cloud.aiplatform.v1beta1.Measurement.elapsed_duration] is used as the x-axis of each
  304. // Trials Decay Curve. Otherwise, [Measurement.step_count][google.cloud.aiplatform.v1beta1.Measurement.step_count] will be used
  305. // as the x-axis.
  306. bool use_elapsed_duration = 1;
  307. }
  308. // The median automated stopping rule stops a pending Trial if the Trial's
  309. // best objective_value is strictly below the median 'performance' of all
  310. // completed Trials reported up to the Trial's last measurement.
  311. // Currently, 'performance' refers to the running average of the objective
  312. // values reported by the Trial in each measurement.
  313. message MedianAutomatedStoppingSpec {
  314. // True if median automated stopping rule applies on
  315. // [Measurement.elapsed_duration][google.cloud.aiplatform.v1beta1.Measurement.elapsed_duration]. It means that elapsed_duration
  316. // field of latest measurement of current Trial is used to compute median
  317. // objective value for each completed Trials.
  318. bool use_elapsed_duration = 1;
  319. }
  320. // Configuration for ConvexStopPolicy.
  321. message ConvexStopConfig {
  322. // Steps used in predicting the final objective for early stopped trials. In
  323. // general, it's set to be the same as the defined steps in training /
  324. // tuning. When use_steps is false, this field is set to the maximum elapsed
  325. // seconds.
  326. int64 max_num_steps = 1;
  327. // Minimum number of steps for a trial to complete. Trials which do not have
  328. // a measurement with num_steps > min_num_steps won't be considered for
  329. // early stopping. It's ok to set it to 0, and a trial can be early stopped
  330. // at any stage. By default, min_num_steps is set to be one-tenth of the
  331. // max_num_steps.
  332. // When use_steps is false, this field is set to the minimum elapsed
  333. // seconds.
  334. int64 min_num_steps = 2;
  335. // The number of Trial measurements used in autoregressive model for
  336. // value prediction. A trial won't be considered early stopping if has fewer
  337. // measurement points.
  338. int64 autoregressive_order = 3;
  339. // The hyper-parameter name used in the tuning job that stands for learning
  340. // rate. Leave it blank if learning rate is not in a parameter in tuning.
  341. // The learning_rate is used to estimate the objective value of the ongoing
  342. // trial.
  343. string learning_rate_parameter_name = 4;
  344. // This bool determines whether or not the rule is applied based on
  345. // elapsed_secs or steps. If use_seconds==false, the early stopping decision
  346. // is made according to the predicted objective values according to the
  347. // target steps. If use_seconds==true, elapsed_secs is used instead of
  348. // steps. Also, in this case, the parameters max_num_steps and min_num_steps
  349. // are overloaded to contain max_elapsed_seconds and min_elapsed_seconds.
  350. bool use_seconds = 5;
  351. }
  352. // The available search algorithms for the Study.
  353. enum Algorithm {
  354. // The default algorithm used by Vertex AI for [hyperparameter
  355. // tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
  356. // and [Vertex Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
  357. ALGORITHM_UNSPECIFIED = 0;
  358. // Simple grid search within the feasible space. To use grid search,
  359. // all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
  360. GRID_SEARCH = 2;
  361. // Simple random search within the feasible space.
  362. RANDOM_SEARCH = 3;
  363. }
  364. // Describes the noise level of the repeated observations.
  365. //
  366. // "Noisy" means that the repeated observations with the same Trial parameters
  367. // may lead to different metric evaluations.
  368. enum ObservationNoise {
  369. // The default noise level chosen by Vertex AI.
  370. OBSERVATION_NOISE_UNSPECIFIED = 0;
  371. // Vertex AI assumes that the objective function is (nearly)
  372. // perfectly reproducible, and will never repeat the same Trial
  373. // parameters.
  374. LOW = 1;
  375. // Vertex AI will estimate the amount of noise in metric
  376. // evaluations, it may repeat the same Trial parameters more than once.
  377. HIGH = 2;
  378. }
  379. // This indicates which measurement to use if/when the service automatically
  380. // selects the final measurement from previously reported intermediate
  381. // measurements. Choose this based on two considerations:
  382. // A) Do you expect your measurements to monotonically improve?
  383. // If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
  384. // situation where your system can "over-train" and you expect the
  385. // performance to get better for a while but then start declining,
  386. // choose BEST_MEASUREMENT.
  387. // B) Are your measurements significantly noisy and/or irreproducible?
  388. // If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
  389. // may be better to choose LAST_MEASUREMENT.
  390. // If both or neither of (A) and (B) apply, it doesn't matter which
  391. // selection type is chosen.
  392. enum MeasurementSelectionType {
  393. // Will be treated as LAST_MEASUREMENT.
  394. MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0;
  395. // Use the last measurement reported.
  396. LAST_MEASUREMENT = 1;
  397. // Use the best measurement reported.
  398. BEST_MEASUREMENT = 2;
  399. }
  400. oneof automated_stopping_spec {
  401. // The automated early stopping spec using decay curve rule.
  402. DecayCurveAutomatedStoppingSpec decay_curve_stopping_spec = 4;
  403. // The automated early stopping spec using median rule.
  404. MedianAutomatedStoppingSpec median_automated_stopping_spec = 5;
  405. // The automated early stopping using convex stopping rule.
  406. ConvexStopConfig convex_stop_config = 8;
  407. }
  408. // Required. Metric specs for the Study.
  409. repeated MetricSpec metrics = 1 [(google.api.field_behavior) = REQUIRED];
  410. // Required. The set of parameters to tune.
  411. repeated ParameterSpec parameters = 2 [(google.api.field_behavior) = REQUIRED];
  412. // The search algorithm specified for the Study.
  413. Algorithm algorithm = 3;
  414. // The observation noise level of the study.
  415. // Currently only supported by the Vizier service. Not supported by
  416. // HyperparamterTuningJob or TrainingPipeline.
  417. ObservationNoise observation_noise = 6;
  418. // Describe which measurement selection type will be used
  419. MeasurementSelectionType measurement_selection_type = 7;
  420. }
  421. // A message representing a Measurement of a Trial. A Measurement contains
  422. // the Metrics got by executing a Trial using suggested hyperparameter
  423. // values.
  424. message Measurement {
  425. // A message representing a metric in the measurement.
  426. message Metric {
  427. // Output only. The ID of the Metric. The Metric should be defined in
  428. // [StudySpec's Metrics][google.cloud.aiplatform.v1beta1.StudySpec.metrics].
  429. string metric_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  430. // Output only. The value for this metric.
  431. double value = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  432. }
  433. // Output only. Time that the Trial has been running at the point of this Measurement.
  434. google.protobuf.Duration elapsed_duration = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  435. // Output only. The number of steps the machine learning model has been trained for.
  436. // Must be non-negative.
  437. int64 step_count = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  438. // Output only. A list of metrics got by evaluating the objective functions using suggested
  439. // Parameter values.
  440. repeated Metric metrics = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  441. }