study.proto 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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.v1;
  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.V1";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1;aiplatform";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "StudyProto";
  26. option java_package = "com.google.cloud.aiplatform.v1";
  27. option php_namespace = "Google\\Cloud\\AIPlatform\\V1";
  28. option ruby_package = "Google::Cloud::AIPlatform::V1";
  29. // A message representing a Trial. A Trial contains a unique set of Parameters
  30. // that has been or will be evaluated, along with the objective metrics got by
  31. // running the Trial.
  32. message Trial {
  33. option (google.api.resource) = {
  34. type: "aiplatform.googleapis.com/Trial"
  35. pattern: "projects/{project}/locations/{location}/studies/{study}/trials/{trial}"
  36. };
  37. // A message representing a parameter to be tuned.
  38. message Parameter {
  39. // Output only. The ID of the parameter. The parameter should be defined in
  40. // [StudySpec's Parameters][google.cloud.aiplatform.v1.StudySpec.parameters].
  41. string parameter_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  42. // Output only. The value of the parameter.
  43. // `number_value` will be set if a parameter defined in StudySpec is
  44. // in type 'INTEGER', 'DOUBLE' or 'DISCRETE'.
  45. // `string_value` will be set if a parameter defined in StudySpec is
  46. // in type 'CATEGORICAL'.
  47. google.protobuf.Value value = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  48. }
  49. // Describes a Trial state.
  50. enum State {
  51. // The Trial state is unspecified.
  52. STATE_UNSPECIFIED = 0;
  53. // Indicates that a specific Trial has been requested, but it has not yet
  54. // been suggested by the service.
  55. REQUESTED = 1;
  56. // Indicates that the Trial has been suggested.
  57. ACTIVE = 2;
  58. // Indicates that the Trial should stop according to the service.
  59. STOPPING = 3;
  60. // Indicates that the Trial is completed successfully.
  61. SUCCEEDED = 4;
  62. // Indicates that the Trial should not be attempted again.
  63. // The service will set a Trial to INFEASIBLE when it's done but missing
  64. // the final_measurement.
  65. INFEASIBLE = 5;
  66. }
  67. // Output only. Resource name of the Trial assigned by the service.
  68. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  69. // Output only. The identifier of the Trial assigned by the service.
  70. string id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  71. // Output only. The detailed state of the Trial.
  72. State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  73. // Output only. The parameters of the Trial.
  74. repeated Parameter parameters = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  75. // Output only. The final measurement containing the objective value.
  76. Measurement final_measurement = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  77. // Output only. A list of measurements that are strictly lexicographically
  78. // ordered by their induced tuples (steps, elapsed_duration).
  79. // These are used for early stopping computations.
  80. repeated Measurement measurements = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  81. // Output only. Time when the Trial was started.
  82. google.protobuf.Timestamp start_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  83. // Output only. Time when the Trial's status changed to `SUCCEEDED` or `INFEASIBLE`.
  84. google.protobuf.Timestamp end_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
  85. // Output only. The identifier of the client that originally requested this Trial.
  86. // Each client is identified by a unique client_id. When a client
  87. // asks for a suggestion, Vizier will assign it a Trial. The client should
  88. // evaluate the Trial, complete it, and report back to Vizier.
  89. // If suggestion is asked again by same client_id before the Trial is
  90. // completed, the same Trial will be returned. Multiple clients with
  91. // different client_ids can ask for suggestions simultaneously, each of them
  92. // will get their own Trial.
  93. string client_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
  94. // Output only. A human readable string describing why the Trial is
  95. // infeasible. This is set only if Trial state is `INFEASIBLE`.
  96. string infeasible_reason = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
  97. // Output only. The CustomJob name linked to the Trial.
  98. // It's set for a HyperparameterTuningJob's Trial.
  99. string custom_job = 11 [
  100. (google.api.field_behavior) = OUTPUT_ONLY,
  101. (google.api.resource_reference) = {
  102. type: "aiplatform.googleapis.com/CustomJob"
  103. }
  104. ];
  105. }
  106. // Represents specification of a Study.
  107. message StudySpec {
  108. // Represents a metric to optimize.
  109. message MetricSpec {
  110. // The available types of optimization goals.
  111. enum GoalType {
  112. // Goal Type will default to maximize.
  113. GOAL_TYPE_UNSPECIFIED = 0;
  114. // Maximize the goal metric.
  115. MAXIMIZE = 1;
  116. // Minimize the goal metric.
  117. MINIMIZE = 2;
  118. }
  119. // Required. The ID of the metric. Must not contain whitespaces and must be unique
  120. // amongst all MetricSpecs.
  121. string metric_id = 1 [(google.api.field_behavior) = REQUIRED];
  122. // Required. The optimization goal of the metric.
  123. GoalType goal = 2 [(google.api.field_behavior) = REQUIRED];
  124. }
  125. // Represents a single parameter to optimize.
  126. message ParameterSpec {
  127. // Value specification for a parameter in `DOUBLE` type.
  128. message DoubleValueSpec {
  129. // Required. Inclusive minimum value of the parameter.
  130. double min_value = 1 [(google.api.field_behavior) = REQUIRED];
  131. // Required. Inclusive maximum value of the parameter.
  132. double max_value = 2 [(google.api.field_behavior) = REQUIRED];
  133. // A default value for a `DOUBLE` parameter that is assumed to be a
  134. // relatively good starting point. Unset value signals that there is no
  135. // offered starting point.
  136. //
  137. // Currently only supported by the Vizier service. Not supported by
  138. // HyperparamterTuningJob or TrainingPipeline.
  139. optional double default_value = 4;
  140. }
  141. // Value specification for a parameter in `INTEGER` type.
  142. message IntegerValueSpec {
  143. // Required. Inclusive minimum value of the parameter.
  144. int64 min_value = 1 [(google.api.field_behavior) = REQUIRED];
  145. // Required. Inclusive maximum value of the parameter.
  146. int64 max_value = 2 [(google.api.field_behavior) = REQUIRED];
  147. // A default value for an `INTEGER` parameter that is assumed to be a
  148. // relatively good starting point. Unset value signals that there is no
  149. // offered starting point.
  150. //
  151. // Currently only supported by the Vizier service. Not supported by
  152. // HyperparamterTuningJob or TrainingPipeline.
  153. optional int64 default_value = 4;
  154. }
  155. // Value specification for a parameter in `CATEGORICAL` type.
  156. message CategoricalValueSpec {
  157. // Required. The list of possible categories.
  158. repeated string values = 1 [(google.api.field_behavior) = REQUIRED];
  159. // A default value for a `CATEGORICAL` parameter that is assumed to be a
  160. // relatively good starting point. Unset value signals that there is no
  161. // offered starting point.
  162. //
  163. // Currently only supported by the Vizier service. Not supported by
  164. // HyperparamterTuningJob or TrainingPipeline.
  165. optional string default_value = 3;
  166. }
  167. // Value specification for a parameter in `DISCRETE` type.
  168. message DiscreteValueSpec {
  169. // Required. A list of possible values.
  170. // The list should be in increasing order and at least 1e-10 apart.
  171. // For instance, this parameter might have possible settings of 1.5, 2.5,
  172. // and 4.0. This list should not contain more than 1,000 values.
  173. repeated double values = 1 [(google.api.field_behavior) = REQUIRED];
  174. // A default value for a `DISCRETE` parameter that is assumed to be a
  175. // relatively good starting point. Unset value signals that there is no
  176. // offered starting point. It automatically rounds to the
  177. // nearest feasible discrete point.
  178. //
  179. // Currently only supported by the Vizier service. Not supported by
  180. // HyperparamterTuningJob or TrainingPipeline.
  181. optional double default_value = 3;
  182. }
  183. // Represents a parameter spec with condition from its parent parameter.
  184. message ConditionalParameterSpec {
  185. // Represents the spec to match discrete values from parent parameter.
  186. message DiscreteValueCondition {
  187. // Required. Matches values of the parent parameter of 'DISCRETE' type.
  188. // All values must exist in `discrete_value_spec` of parent parameter.
  189. //
  190. // The Epsilon of the value matching is 1e-10.
  191. repeated double values = 1 [(google.api.field_behavior) = REQUIRED];
  192. }
  193. // Represents the spec to match integer values from parent parameter.
  194. message IntValueCondition {
  195. // Required. Matches values of the parent parameter of 'INTEGER' type.
  196. // All values must lie in `integer_value_spec` of parent parameter.
  197. repeated int64 values = 1 [(google.api.field_behavior) = REQUIRED];
  198. }
  199. // Represents the spec to match categorical values from parent parameter.
  200. message CategoricalValueCondition {
  201. // Required. Matches values of the parent parameter of 'CATEGORICAL' type.
  202. // All values must exist in `categorical_value_spec` of parent
  203. // parameter.
  204. repeated string values = 1 [(google.api.field_behavior) = REQUIRED];
  205. }
  206. // A set of parameter values from the parent ParameterSpec's feasible
  207. // space.
  208. oneof parent_value_condition {
  209. // The spec for matching values from a parent parameter of
  210. // `DISCRETE` type.
  211. DiscreteValueCondition parent_discrete_values = 2;
  212. // The spec for matching values from a parent parameter of `INTEGER`
  213. // type.
  214. IntValueCondition parent_int_values = 3;
  215. // The spec for matching values from a parent parameter of
  216. // `CATEGORICAL` type.
  217. CategoricalValueCondition parent_categorical_values = 4;
  218. }
  219. // Required. The spec for a conditional parameter.
  220. ParameterSpec parameter_spec = 1 [(google.api.field_behavior) = REQUIRED];
  221. }
  222. // The type of scaling that should be applied to this parameter.
  223. enum ScaleType {
  224. // By default, no scaling is applied.
  225. SCALE_TYPE_UNSPECIFIED = 0;
  226. // Scales the feasible space to (0, 1) linearly.
  227. UNIT_LINEAR_SCALE = 1;
  228. // Scales the feasible space logarithmically to (0, 1). The entire
  229. // feasible space must be strictly positive.
  230. UNIT_LOG_SCALE = 2;
  231. // Scales the feasible space "reverse" logarithmically to (0, 1). The
  232. // result is that values close to the top of the feasible space are spread
  233. // out more than points near the bottom. The entire feasible space must be
  234. // strictly positive.
  235. UNIT_REVERSE_LOG_SCALE = 3;
  236. }
  237. oneof parameter_value_spec {
  238. // The value spec for a 'DOUBLE' parameter.
  239. DoubleValueSpec double_value_spec = 2;
  240. // The value spec for an 'INTEGER' parameter.
  241. IntegerValueSpec integer_value_spec = 3;
  242. // The value spec for a 'CATEGORICAL' parameter.
  243. CategoricalValueSpec categorical_value_spec = 4;
  244. // The value spec for a 'DISCRETE' parameter.
  245. DiscreteValueSpec discrete_value_spec = 5;
  246. }
  247. // Required. The ID of the parameter. Must not contain whitespaces and must be unique
  248. // amongst all ParameterSpecs.
  249. string parameter_id = 1 [(google.api.field_behavior) = REQUIRED];
  250. // How the parameter should be scaled.
  251. // Leave unset for `CATEGORICAL` parameters.
  252. ScaleType scale_type = 6;
  253. // A conditional parameter node is active if the parameter's value matches
  254. // the conditional node's parent_value_condition.
  255. //
  256. // If two items in conditional_parameter_specs have the same name, they
  257. // must have disjoint parent_value_condition.
  258. repeated ConditionalParameterSpec conditional_parameter_specs = 10;
  259. }
  260. // The available search algorithms for the Study.
  261. enum Algorithm {
  262. // The default algorithm used by Vertex AI for [hyperparameter
  263. // tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
  264. // and [Vertex Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
  265. ALGORITHM_UNSPECIFIED = 0;
  266. // Simple grid search within the feasible space. To use grid search,
  267. // all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
  268. GRID_SEARCH = 2;
  269. // Simple random search within the feasible space.
  270. RANDOM_SEARCH = 3;
  271. }
  272. // Describes the noise level of the repeated observations.
  273. //
  274. // "Noisy" means that the repeated observations with the same Trial parameters
  275. // may lead to different metric evaluations.
  276. enum ObservationNoise {
  277. // The default noise level chosen by Vertex AI.
  278. OBSERVATION_NOISE_UNSPECIFIED = 0;
  279. // Vertex AI assumes that the objective function is (nearly)
  280. // perfectly reproducible, and will never repeat the same Trial
  281. // parameters.
  282. LOW = 1;
  283. // Vertex AI will estimate the amount of noise in metric
  284. // evaluations, it may repeat the same Trial parameters more than once.
  285. HIGH = 2;
  286. }
  287. // This indicates which measurement to use if/when the service automatically
  288. // selects the final measurement from previously reported intermediate
  289. // measurements. Choose this based on two considerations:
  290. // A) Do you expect your measurements to monotonically improve?
  291. // If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
  292. // situation where your system can "over-train" and you expect the
  293. // performance to get better for a while but then start declining,
  294. // choose BEST_MEASUREMENT.
  295. // B) Are your measurements significantly noisy and/or irreproducible?
  296. // If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
  297. // may be better to choose LAST_MEASUREMENT.
  298. // If both or neither of (A) and (B) apply, it doesn't matter which
  299. // selection type is chosen.
  300. enum MeasurementSelectionType {
  301. // Will be treated as LAST_MEASUREMENT.
  302. MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0;
  303. // Use the last measurement reported.
  304. LAST_MEASUREMENT = 1;
  305. // Use the best measurement reported.
  306. BEST_MEASUREMENT = 2;
  307. }
  308. // Required. Metric specs for the Study.
  309. repeated MetricSpec metrics = 1 [(google.api.field_behavior) = REQUIRED];
  310. // Required. The set of parameters to tune.
  311. repeated ParameterSpec parameters = 2 [(google.api.field_behavior) = REQUIRED];
  312. // The search algorithm specified for the Study.
  313. Algorithm algorithm = 3;
  314. // The observation noise level of the study.
  315. // Currently only supported by the Vizier service. Not supported by
  316. // HyperparamterTuningJob or TrainingPipeline.
  317. ObservationNoise observation_noise = 6;
  318. // Describe which measurement selection type will be used
  319. MeasurementSelectionType measurement_selection_type = 7;
  320. }
  321. // A message representing a Measurement of a Trial. A Measurement contains
  322. // the Metrics got by executing a Trial using suggested hyperparameter
  323. // values.
  324. message Measurement {
  325. // A message representing a metric in the measurement.
  326. message Metric {
  327. // Output only. The ID of the Metric. The Metric should be defined in
  328. // [StudySpec's Metrics][google.cloud.aiplatform.v1.StudySpec.metrics].
  329. string metric_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  330. // Output only. The value for this metric.
  331. double value = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  332. }
  333. // Output only. Time that the Trial has been running at the point of this Measurement.
  334. google.protobuf.Duration elapsed_duration = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  335. // Output only. The number of steps the machine learning model has been trained for.
  336. // Must be non-negative.
  337. int64 step_count = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  338. // Output only. A list of metrics got by evaluating the objective functions using suggested
  339. // Parameter values.
  340. repeated Metric metrics = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  341. }