Class: Google::Cloud::AIPlatform::V1::StudySpec

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/cloud/aiplatform/v1/study.rb

Overview

Represents specification of a Study.

Defined Under Namespace

Modules: Algorithm, MeasurementSelectionType, ObservationNoise Classes: ConvexAutomatedStoppingSpec, DecayCurveAutomatedStoppingSpec, MedianAutomatedStoppingSpec, MetricSpec, ParameterSpec, StudyStoppingConfig

Instance Attribute Summary collapse

Instance Attribute Details

#algorithm::Google::Cloud::AIPlatform::V1::StudySpec::Algorithm

Returns The search algorithm specified for the Study.

Returns:



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'proto_docs/google/cloud/aiplatform/v1/study.rb', line 250

class StudySpec
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Represents a metric to optimize.
  # @!attribute [rw] metric_id
  #   @return [::String]
  #     Required. The ID of the metric. Must not contain whitespaces and must be
  #     unique amongst all MetricSpecs.
  # @!attribute [rw] goal
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::GoalType]
  #     Required. The optimization goal of the metric.
  # @!attribute [rw] safety_config
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::SafetyMetricConfig]
  #     Used for safe search. In the case, the metric will be a safety
  #     metric. You must provide a separate metric for objective metric.
  class MetricSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Used in safe optimization to specify threshold levels and risk tolerance.
    # @!attribute [rw] safety_threshold
    #   @return [::Float]
    #     Safety threshold (boundary value between safe and unsafe). NOTE that if
    #     you leave SafetyMetricConfig unset, a default value of 0 will be used.
    # @!attribute [rw] desired_min_safe_trials_fraction
    #   @return [::Float]
    #     Desired minimum fraction of safe trials (over total number of trials)
    #     that should be targeted by the algorithm at any time during the
    #     study (best effort). This should be between 0.0 and 1.0 and a value of
    #     0.0 means that there is no minimum and an algorithm proceeds without
    #     targeting any specific fraction. A value of 1.0 means that the
    #     algorithm attempts to only Suggest safe Trials.
    class SafetyMetricConfig
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # The available types of optimization goals.
    module GoalType
      # Goal Type will default to maximize.
      GOAL_TYPE_UNSPECIFIED = 0

      # Maximize the goal metric.
      MAXIMIZE = 1

      # Minimize the goal metric.
      MINIMIZE = 2
    end
  end

  # Represents a single parameter to optimize.
  # @!attribute [rw] double_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DoubleValueSpec]
  #     The value spec for a 'DOUBLE' parameter.
  # @!attribute [rw] integer_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::IntegerValueSpec]
  #     The value spec for an 'INTEGER' parameter.
  # @!attribute [rw] categorical_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::CategoricalValueSpec]
  #     The value spec for a 'CATEGORICAL' parameter.
  # @!attribute [rw] discrete_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DiscreteValueSpec]
  #     The value spec for a 'DISCRETE' parameter.
  # @!attribute [rw] parameter_id
  #   @return [::String]
  #     Required. The ID of the parameter. Must not contain whitespaces and must
  #     be unique amongst all ParameterSpecs.
  # @!attribute [rw] scale_type
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ScaleType]
  #     How the parameter should be scaled.
  #     Leave unset for `CATEGORICAL` parameters.
  # @!attribute [rw] conditional_parameter_specs
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec>]
  #     A conditional parameter node is active if the parameter's value matches
  #     the conditional node's parent_value_condition.
  #
  #     If two items in conditional_parameter_specs have the same name, they
  #     must have disjoint parent_value_condition.
  class ParameterSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Value specification for a parameter in `DOUBLE` type.
    # @!attribute [rw] min_value
    #   @return [::Float]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Float]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DOUBLE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DoubleValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `INTEGER` type.
    # @!attribute [rw] min_value
    #   @return [::Integer]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Integer]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Integer]
    #     A default value for an `INTEGER` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class IntegerValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `CATEGORICAL` type.
    # @!attribute [rw] values
    #   @return [::Array<::String>]
    #     Required. The list of possible categories.
    # @!attribute [rw] default_value
    #   @return [::String]
    #     A default value for a `CATEGORICAL` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class CategoricalValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `DISCRETE` type.
    # @!attribute [rw] values
    #   @return [::Array<::Float>]
    #     Required. A list of possible values.
    #     The list should be in increasing order and at least 1e-10 apart.
    #     For instance, this parameter might have possible settings of 1.5, 2.5,
    #     and 4.0. This list should not contain more than 1,000 values.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DISCRETE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.  It automatically rounds to the
    #     nearest feasible discrete point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DiscreteValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Represents a parameter spec with condition from its parent parameter.
    # @!attribute [rw] parent_discrete_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::DiscreteValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `DISCRETE` type.
    # @!attribute [rw] parent_int_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::IntValueCondition]
    #     The spec for matching values from a parent parameter of `INTEGER`
    #     type.
    # @!attribute [rw] parent_categorical_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::CategoricalValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `CATEGORICAL` type.
    # @!attribute [rw] parameter_spec
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec]
    #     Required. The spec for a conditional parameter.
    class ConditionalParameterSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Represents the spec to match discrete values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Float>]
      #     Required. Matches values of the parent parameter of 'DISCRETE' type.
      #     All values must exist in `discrete_value_spec` of parent parameter.
      #
      #     The Epsilon of the value matching is 1e-10.
      class DiscreteValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match integer values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Integer>]
      #     Required. Matches values of the parent parameter of 'INTEGER' type.
      #     All values must lie in `integer_value_spec` of parent parameter.
      class IntValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match categorical values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::String>]
      #     Required. Matches values of the parent parameter of 'CATEGORICAL'
      #     type. All values must exist in `categorical_value_spec` of parent
      #     parameter.
      class CategoricalValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # The type of scaling that should be applied to this parameter.
    module ScaleType
      # By default, no scaling is applied.
      SCALE_TYPE_UNSPECIFIED = 0

      # Scales the feasible space to (0, 1) linearly.
      UNIT_LINEAR_SCALE = 1

      # Scales the feasible space logarithmically to (0, 1). The entire
      # feasible space must be strictly positive.
      UNIT_LOG_SCALE = 2

      # Scales the feasible space "reverse" logarithmically to (0, 1). The
      # result is that values close to the top of the feasible space are spread
      # out more than points near the bottom. The entire feasible space must be
      # strictly positive.
      UNIT_REVERSE_LOG_SCALE = 3
    end
  end

  # The decay curve automated stopping rule builds a Gaussian Process
  # Regressor to predict the final objective value of a Trial based on the
  # already completed Trials and the intermediate measurements of the current
  # Trial. Early stopping is requested for the current Trial if there is very
  # low probability to exceed the optimal value found so far.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}
  #     is used as the x-axis of each Trials Decay Curve. Otherwise,
  #     {::Google::Cloud::AIPlatform::V1::Measurement#step_count Measurement.step_count}
  #     will be used as the x-axis.
  class DecayCurveAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The median automated stopping rule stops a pending Trial if the Trial's
  # best objective_value is strictly below the median 'performance' of all
  # completed Trials reported up to the Trial's last measurement.
  # Currently, 'performance' refers to the running average of the objective
  # values reported by the Trial in each measurement.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if median automated stopping rule applies on
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}.
  #     It means that elapsed_duration field of latest measurement of current
  #     Trial is used to compute median objective value for each completed
  #     Trials.
  class MedianAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Configuration for ConvexAutomatedStoppingSpec.
  # When there are enough completed trials (configured by
  # min_measurement_count), for pending trials with enough measurements and
  # steps, the policy first computes an overestimate of the objective value at
  # max_num_steps according to the slope of the incomplete objective value
  # curve. No prediction can be made if the curve is completely flat. If the
  # overestimation is worse than the best objective value of the completed
  # trials, this pending trial will be early-stopped, but a last measurement
  # will be added to the pending trial with max_num_steps and predicted
  # objective value from the autoregression model.
  # @!attribute [rw] max_step_count
  #   @return [::Integer]
  #     Steps used in predicting the final objective for early stopped trials. In
  #     general, it's set to be the same as the defined steps in training /
  #     tuning. If not defined, it will learn it from the completed trials. When
  #     use_steps is false, this field is set to the maximum elapsed seconds.
  # @!attribute [rw] min_step_count
  #   @return [::Integer]
  #     Minimum number of steps for a trial to complete. Trials which do not have
  #     a measurement with step_count > min_step_count won't be considered for
  #     early stopping. It's ok to set it to 0, and a trial can be early stopped
  #     at any stage. By default, min_step_count is set to be one-tenth of the
  #     max_step_count.
  #     When use_elapsed_duration is true, this field is set to the minimum
  #     elapsed seconds.
  # @!attribute [rw] min_measurement_count
  #   @return [::Integer]
  #     The minimal number of measurements in a Trial.  Early-stopping checks
  #     will not trigger if less than min_measurement_count+1 completed trials or
  #     pending trials with less than min_measurement_count measurements. If not
  #     defined, the default value is 5.
  # @!attribute [rw] learning_rate_parameter_name
  #   @return [::String]
  #     The hyper-parameter name used in the tuning job that stands for learning
  #     rate. Leave it blank if learning rate is not in a parameter in tuning.
  #     The learning_rate is used to estimate the objective value of the ongoing
  #     trial.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     This bool determines whether or not the rule is applied based on
  #     elapsed_secs or steps. If use_elapsed_duration==false, the early stopping
  #     decision is made according to the predicted objective values according to
  #     the target steps. If use_elapsed_duration==true, elapsed_secs is used
  #     instead of steps. Also, in this case, the parameters max_num_steps and
  #     min_num_steps are overloaded to contain max_elapsed_seconds and
  #     min_elapsed_seconds.
  # @!attribute [rw] update_all_stopped_trials
  #   @return [::Boolean]
  #     ConvexAutomatedStoppingSpec by default only updates the trials that needs
  #     to be early stopped using a newly trained auto-regressive model. When
  #     this flag is set to True, all stopped trials from the beginning are
  #     potentially updated in terms of their `final_measurement`. Also, note
  #     that the training logic of autoregressive models is different in this
  #     case. Enabling this option has shown better results and this may be the
  #     default option in the future.
  class ConvexAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The configuration (stopping conditions) for automated stopping of a Study.
  # Conditions include trial budgets, time budgets, and convergence detection.
  # @!attribute [rw] should_stop_asap
  #   @return [::Google::Protobuf::BoolValue]
  #     If true, a Study enters STOPPING_ASAP whenever it would normally enters
  #     STOPPING state.
  #
  #     The bottom line is: set to true if you want to interrupt on-going
  #     evaluations of Trials as soon as the study stopping condition is met.
  #     (Please see Study.State documentation for the source of truth).
  # @!attribute [rw] minimum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     Each "stopping rule" in this proto specifies an "if" condition. Before
  #     Vizier would generate a new suggestion, it first checks each specified
  #     stopping rule, from top to bottom in this list.
  #     Note that the first few rules (e.g. minimum_runtime_constraint,
  #     min_num_trials) will prevent other stopping rules from being evaluated
  #     until they are met. For example, setting `min_num_trials=5` and
  #     `always_stop_after= 1 hour` means that the Study will ONLY stop after it
  #     has 5 COMPLETED trials, even if more than an hour has passed since its
  #     creation. It follows the first applicable rule (whose "if" condition is
  #     satisfied) to make a stopping decision. If none of the specified rules
  #     are applicable, then Vizier decides that the study should not stop.
  #     If Vizier decides that the study should stop, the study enters
  #     STOPPING state (or STOPPING_ASAP if should_stop_asap = true).
  #     IMPORTANT: The automatic study state transition happens precisely as
  #     described above; that is, deleting trials or updating StudyConfig NEVER
  #     automatically moves the study state back to ACTIVE. If you want to
  #     _resume_ a Study that was stopped, 1) change the stopping conditions if
  #     necessary, 2) activate the study, and then 3) ask for suggestions.
  #     If the specified time or duration has not passed, do not stop the
  #     study.
  # @!attribute [rw] maximum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     If the specified time or duration has passed, stop the study.
  # @!attribute [rw] min_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are fewer than this many COMPLETED trials, do not stop the
  #     study.
  # @!attribute [rw] max_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are more than this many trials, stop the study.
  # @!attribute [rw] max_num_trials_no_progress
  #   @return [::Google::Protobuf::Int32Value]
  #     If the objective value has not improved for this many consecutive
  #     trials, stop the study.
  #
  #     WARNING: Effective only for single-objective studies.
  # @!attribute [rw] max_duration_no_progress
  #   @return [::Google::Protobuf::Duration]
  #     If the objective value has not improved for this much time, stop the
  #     study.
  #
  #     WARNING: Effective only for single-objective studies.
  class StudyStoppingConfig
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The available search algorithms for the Study.
  module Algorithm
    # The default algorithm used by Vertex AI for [hyperparameter
    # tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
    # and [Vertex AI Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
    ALGORITHM_UNSPECIFIED = 0

    # Simple grid search within the feasible space. To use grid search,
    # all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
    GRID_SEARCH = 2

    # Simple random search within the feasible space.
    RANDOM_SEARCH = 3
  end

  # Describes the noise level of the repeated observations.
  #
  # "Noisy" means that the repeated observations with the same Trial parameters
  # may lead to different metric evaluations.
  module ObservationNoise
    # The default noise level chosen by Vertex AI.
    OBSERVATION_NOISE_UNSPECIFIED = 0

    # Vertex AI assumes that the objective function is (nearly)
    # perfectly reproducible, and will never repeat the same Trial
    # parameters.
    LOW = 1

    # Vertex AI will estimate the amount of noise in metric
    # evaluations, it may repeat the same Trial parameters more than once.
    HIGH = 2
  end

  # This indicates which measurement to use if/when the service automatically
  # selects the final measurement from previously reported intermediate
  # measurements. Choose this based on two considerations:
  #  A) Do you expect your measurements to monotonically improve?
  #     If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
  #     situation where your system can "over-train" and you expect the
  #     performance to get better for a while but then start declining,
  #     choose BEST_MEASUREMENT.
  #  B) Are your measurements significantly noisy and/or irreproducible?
  #     If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
  #     may be better to choose LAST_MEASUREMENT.
  #  If both or neither of (A) and (B) apply, it doesn't matter which
  #  selection type is chosen.
  module MeasurementSelectionType
    # Will be treated as LAST_MEASUREMENT.
    MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0

    # Use the last measurement reported.
    LAST_MEASUREMENT = 1

    # Use the best measurement reported.
    BEST_MEASUREMENT = 2
  end
end

#convex_automated_stopping_spec::Google::Cloud::AIPlatform::V1::StudySpec::ConvexAutomatedStoppingSpec

Returns The automated early stopping spec using convex stopping rule.

Returns:



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'proto_docs/google/cloud/aiplatform/v1/study.rb', line 250

class StudySpec
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Represents a metric to optimize.
  # @!attribute [rw] metric_id
  #   @return [::String]
  #     Required. The ID of the metric. Must not contain whitespaces and must be
  #     unique amongst all MetricSpecs.
  # @!attribute [rw] goal
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::GoalType]
  #     Required. The optimization goal of the metric.
  # @!attribute [rw] safety_config
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::SafetyMetricConfig]
  #     Used for safe search. In the case, the metric will be a safety
  #     metric. You must provide a separate metric for objective metric.
  class MetricSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Used in safe optimization to specify threshold levels and risk tolerance.
    # @!attribute [rw] safety_threshold
    #   @return [::Float]
    #     Safety threshold (boundary value between safe and unsafe). NOTE that if
    #     you leave SafetyMetricConfig unset, a default value of 0 will be used.
    # @!attribute [rw] desired_min_safe_trials_fraction
    #   @return [::Float]
    #     Desired minimum fraction of safe trials (over total number of trials)
    #     that should be targeted by the algorithm at any time during the
    #     study (best effort). This should be between 0.0 and 1.0 and a value of
    #     0.0 means that there is no minimum and an algorithm proceeds without
    #     targeting any specific fraction. A value of 1.0 means that the
    #     algorithm attempts to only Suggest safe Trials.
    class SafetyMetricConfig
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # The available types of optimization goals.
    module GoalType
      # Goal Type will default to maximize.
      GOAL_TYPE_UNSPECIFIED = 0

      # Maximize the goal metric.
      MAXIMIZE = 1

      # Minimize the goal metric.
      MINIMIZE = 2
    end
  end

  # Represents a single parameter to optimize.
  # @!attribute [rw] double_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DoubleValueSpec]
  #     The value spec for a 'DOUBLE' parameter.
  # @!attribute [rw] integer_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::IntegerValueSpec]
  #     The value spec for an 'INTEGER' parameter.
  # @!attribute [rw] categorical_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::CategoricalValueSpec]
  #     The value spec for a 'CATEGORICAL' parameter.
  # @!attribute [rw] discrete_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DiscreteValueSpec]
  #     The value spec for a 'DISCRETE' parameter.
  # @!attribute [rw] parameter_id
  #   @return [::String]
  #     Required. The ID of the parameter. Must not contain whitespaces and must
  #     be unique amongst all ParameterSpecs.
  # @!attribute [rw] scale_type
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ScaleType]
  #     How the parameter should be scaled.
  #     Leave unset for `CATEGORICAL` parameters.
  # @!attribute [rw] conditional_parameter_specs
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec>]
  #     A conditional parameter node is active if the parameter's value matches
  #     the conditional node's parent_value_condition.
  #
  #     If two items in conditional_parameter_specs have the same name, they
  #     must have disjoint parent_value_condition.
  class ParameterSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Value specification for a parameter in `DOUBLE` type.
    # @!attribute [rw] min_value
    #   @return [::Float]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Float]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DOUBLE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DoubleValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `INTEGER` type.
    # @!attribute [rw] min_value
    #   @return [::Integer]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Integer]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Integer]
    #     A default value for an `INTEGER` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class IntegerValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `CATEGORICAL` type.
    # @!attribute [rw] values
    #   @return [::Array<::String>]
    #     Required. The list of possible categories.
    # @!attribute [rw] default_value
    #   @return [::String]
    #     A default value for a `CATEGORICAL` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class CategoricalValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `DISCRETE` type.
    # @!attribute [rw] values
    #   @return [::Array<::Float>]
    #     Required. A list of possible values.
    #     The list should be in increasing order and at least 1e-10 apart.
    #     For instance, this parameter might have possible settings of 1.5, 2.5,
    #     and 4.0. This list should not contain more than 1,000 values.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DISCRETE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.  It automatically rounds to the
    #     nearest feasible discrete point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DiscreteValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Represents a parameter spec with condition from its parent parameter.
    # @!attribute [rw] parent_discrete_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::DiscreteValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `DISCRETE` type.
    # @!attribute [rw] parent_int_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::IntValueCondition]
    #     The spec for matching values from a parent parameter of `INTEGER`
    #     type.
    # @!attribute [rw] parent_categorical_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::CategoricalValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `CATEGORICAL` type.
    # @!attribute [rw] parameter_spec
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec]
    #     Required. The spec for a conditional parameter.
    class ConditionalParameterSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Represents the spec to match discrete values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Float>]
      #     Required. Matches values of the parent parameter of 'DISCRETE' type.
      #     All values must exist in `discrete_value_spec` of parent parameter.
      #
      #     The Epsilon of the value matching is 1e-10.
      class DiscreteValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match integer values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Integer>]
      #     Required. Matches values of the parent parameter of 'INTEGER' type.
      #     All values must lie in `integer_value_spec` of parent parameter.
      class IntValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match categorical values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::String>]
      #     Required. Matches values of the parent parameter of 'CATEGORICAL'
      #     type. All values must exist in `categorical_value_spec` of parent
      #     parameter.
      class CategoricalValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # The type of scaling that should be applied to this parameter.
    module ScaleType
      # By default, no scaling is applied.
      SCALE_TYPE_UNSPECIFIED = 0

      # Scales the feasible space to (0, 1) linearly.
      UNIT_LINEAR_SCALE = 1

      # Scales the feasible space logarithmically to (0, 1). The entire
      # feasible space must be strictly positive.
      UNIT_LOG_SCALE = 2

      # Scales the feasible space "reverse" logarithmically to (0, 1). The
      # result is that values close to the top of the feasible space are spread
      # out more than points near the bottom. The entire feasible space must be
      # strictly positive.
      UNIT_REVERSE_LOG_SCALE = 3
    end
  end

  # The decay curve automated stopping rule builds a Gaussian Process
  # Regressor to predict the final objective value of a Trial based on the
  # already completed Trials and the intermediate measurements of the current
  # Trial. Early stopping is requested for the current Trial if there is very
  # low probability to exceed the optimal value found so far.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}
  #     is used as the x-axis of each Trials Decay Curve. Otherwise,
  #     {::Google::Cloud::AIPlatform::V1::Measurement#step_count Measurement.step_count}
  #     will be used as the x-axis.
  class DecayCurveAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The median automated stopping rule stops a pending Trial if the Trial's
  # best objective_value is strictly below the median 'performance' of all
  # completed Trials reported up to the Trial's last measurement.
  # Currently, 'performance' refers to the running average of the objective
  # values reported by the Trial in each measurement.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if median automated stopping rule applies on
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}.
  #     It means that elapsed_duration field of latest measurement of current
  #     Trial is used to compute median objective value for each completed
  #     Trials.
  class MedianAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Configuration for ConvexAutomatedStoppingSpec.
  # When there are enough completed trials (configured by
  # min_measurement_count), for pending trials with enough measurements and
  # steps, the policy first computes an overestimate of the objective value at
  # max_num_steps according to the slope of the incomplete objective value
  # curve. No prediction can be made if the curve is completely flat. If the
  # overestimation is worse than the best objective value of the completed
  # trials, this pending trial will be early-stopped, but a last measurement
  # will be added to the pending trial with max_num_steps and predicted
  # objective value from the autoregression model.
  # @!attribute [rw] max_step_count
  #   @return [::Integer]
  #     Steps used in predicting the final objective for early stopped trials. In
  #     general, it's set to be the same as the defined steps in training /
  #     tuning. If not defined, it will learn it from the completed trials. When
  #     use_steps is false, this field is set to the maximum elapsed seconds.
  # @!attribute [rw] min_step_count
  #   @return [::Integer]
  #     Minimum number of steps for a trial to complete. Trials which do not have
  #     a measurement with step_count > min_step_count won't be considered for
  #     early stopping. It's ok to set it to 0, and a trial can be early stopped
  #     at any stage. By default, min_step_count is set to be one-tenth of the
  #     max_step_count.
  #     When use_elapsed_duration is true, this field is set to the minimum
  #     elapsed seconds.
  # @!attribute [rw] min_measurement_count
  #   @return [::Integer]
  #     The minimal number of measurements in a Trial.  Early-stopping checks
  #     will not trigger if less than min_measurement_count+1 completed trials or
  #     pending trials with less than min_measurement_count measurements. If not
  #     defined, the default value is 5.
  # @!attribute [rw] learning_rate_parameter_name
  #   @return [::String]
  #     The hyper-parameter name used in the tuning job that stands for learning
  #     rate. Leave it blank if learning rate is not in a parameter in tuning.
  #     The learning_rate is used to estimate the objective value of the ongoing
  #     trial.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     This bool determines whether or not the rule is applied based on
  #     elapsed_secs or steps. If use_elapsed_duration==false, the early stopping
  #     decision is made according to the predicted objective values according to
  #     the target steps. If use_elapsed_duration==true, elapsed_secs is used
  #     instead of steps. Also, in this case, the parameters max_num_steps and
  #     min_num_steps are overloaded to contain max_elapsed_seconds and
  #     min_elapsed_seconds.
  # @!attribute [rw] update_all_stopped_trials
  #   @return [::Boolean]
  #     ConvexAutomatedStoppingSpec by default only updates the trials that needs
  #     to be early stopped using a newly trained auto-regressive model. When
  #     this flag is set to True, all stopped trials from the beginning are
  #     potentially updated in terms of their `final_measurement`. Also, note
  #     that the training logic of autoregressive models is different in this
  #     case. Enabling this option has shown better results and this may be the
  #     default option in the future.
  class ConvexAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The configuration (stopping conditions) for automated stopping of a Study.
  # Conditions include trial budgets, time budgets, and convergence detection.
  # @!attribute [rw] should_stop_asap
  #   @return [::Google::Protobuf::BoolValue]
  #     If true, a Study enters STOPPING_ASAP whenever it would normally enters
  #     STOPPING state.
  #
  #     The bottom line is: set to true if you want to interrupt on-going
  #     evaluations of Trials as soon as the study stopping condition is met.
  #     (Please see Study.State documentation for the source of truth).
  # @!attribute [rw] minimum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     Each "stopping rule" in this proto specifies an "if" condition. Before
  #     Vizier would generate a new suggestion, it first checks each specified
  #     stopping rule, from top to bottom in this list.
  #     Note that the first few rules (e.g. minimum_runtime_constraint,
  #     min_num_trials) will prevent other stopping rules from being evaluated
  #     until they are met. For example, setting `min_num_trials=5` and
  #     `always_stop_after= 1 hour` means that the Study will ONLY stop after it
  #     has 5 COMPLETED trials, even if more than an hour has passed since its
  #     creation. It follows the first applicable rule (whose "if" condition is
  #     satisfied) to make a stopping decision. If none of the specified rules
  #     are applicable, then Vizier decides that the study should not stop.
  #     If Vizier decides that the study should stop, the study enters
  #     STOPPING state (or STOPPING_ASAP if should_stop_asap = true).
  #     IMPORTANT: The automatic study state transition happens precisely as
  #     described above; that is, deleting trials or updating StudyConfig NEVER
  #     automatically moves the study state back to ACTIVE. If you want to
  #     _resume_ a Study that was stopped, 1) change the stopping conditions if
  #     necessary, 2) activate the study, and then 3) ask for suggestions.
  #     If the specified time or duration has not passed, do not stop the
  #     study.
  # @!attribute [rw] maximum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     If the specified time or duration has passed, stop the study.
  # @!attribute [rw] min_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are fewer than this many COMPLETED trials, do not stop the
  #     study.
  # @!attribute [rw] max_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are more than this many trials, stop the study.
  # @!attribute [rw] max_num_trials_no_progress
  #   @return [::Google::Protobuf::Int32Value]
  #     If the objective value has not improved for this many consecutive
  #     trials, stop the study.
  #
  #     WARNING: Effective only for single-objective studies.
  # @!attribute [rw] max_duration_no_progress
  #   @return [::Google::Protobuf::Duration]
  #     If the objective value has not improved for this much time, stop the
  #     study.
  #
  #     WARNING: Effective only for single-objective studies.
  class StudyStoppingConfig
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The available search algorithms for the Study.
  module Algorithm
    # The default algorithm used by Vertex AI for [hyperparameter
    # tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
    # and [Vertex AI Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
    ALGORITHM_UNSPECIFIED = 0

    # Simple grid search within the feasible space. To use grid search,
    # all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
    GRID_SEARCH = 2

    # Simple random search within the feasible space.
    RANDOM_SEARCH = 3
  end

  # Describes the noise level of the repeated observations.
  #
  # "Noisy" means that the repeated observations with the same Trial parameters
  # may lead to different metric evaluations.
  module ObservationNoise
    # The default noise level chosen by Vertex AI.
    OBSERVATION_NOISE_UNSPECIFIED = 0

    # Vertex AI assumes that the objective function is (nearly)
    # perfectly reproducible, and will never repeat the same Trial
    # parameters.
    LOW = 1

    # Vertex AI will estimate the amount of noise in metric
    # evaluations, it may repeat the same Trial parameters more than once.
    HIGH = 2
  end

  # This indicates which measurement to use if/when the service automatically
  # selects the final measurement from previously reported intermediate
  # measurements. Choose this based on two considerations:
  #  A) Do you expect your measurements to monotonically improve?
  #     If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
  #     situation where your system can "over-train" and you expect the
  #     performance to get better for a while but then start declining,
  #     choose BEST_MEASUREMENT.
  #  B) Are your measurements significantly noisy and/or irreproducible?
  #     If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
  #     may be better to choose LAST_MEASUREMENT.
  #  If both or neither of (A) and (B) apply, it doesn't matter which
  #  selection type is chosen.
  module MeasurementSelectionType
    # Will be treated as LAST_MEASUREMENT.
    MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0

    # Use the last measurement reported.
    LAST_MEASUREMENT = 1

    # Use the best measurement reported.
    BEST_MEASUREMENT = 2
  end
end

#decay_curve_stopping_spec::Google::Cloud::AIPlatform::V1::StudySpec::DecayCurveAutomatedStoppingSpec

Returns The automated early stopping spec using decay curve rule.

Returns:



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'proto_docs/google/cloud/aiplatform/v1/study.rb', line 250

class StudySpec
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Represents a metric to optimize.
  # @!attribute [rw] metric_id
  #   @return [::String]
  #     Required. The ID of the metric. Must not contain whitespaces and must be
  #     unique amongst all MetricSpecs.
  # @!attribute [rw] goal
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::GoalType]
  #     Required. The optimization goal of the metric.
  # @!attribute [rw] safety_config
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::SafetyMetricConfig]
  #     Used for safe search. In the case, the metric will be a safety
  #     metric. You must provide a separate metric for objective metric.
  class MetricSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Used in safe optimization to specify threshold levels and risk tolerance.
    # @!attribute [rw] safety_threshold
    #   @return [::Float]
    #     Safety threshold (boundary value between safe and unsafe). NOTE that if
    #     you leave SafetyMetricConfig unset, a default value of 0 will be used.
    # @!attribute [rw] desired_min_safe_trials_fraction
    #   @return [::Float]
    #     Desired minimum fraction of safe trials (over total number of trials)
    #     that should be targeted by the algorithm at any time during the
    #     study (best effort). This should be between 0.0 and 1.0 and a value of
    #     0.0 means that there is no minimum and an algorithm proceeds without
    #     targeting any specific fraction. A value of 1.0 means that the
    #     algorithm attempts to only Suggest safe Trials.
    class SafetyMetricConfig
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # The available types of optimization goals.
    module GoalType
      # Goal Type will default to maximize.
      GOAL_TYPE_UNSPECIFIED = 0

      # Maximize the goal metric.
      MAXIMIZE = 1

      # Minimize the goal metric.
      MINIMIZE = 2
    end
  end

  # Represents a single parameter to optimize.
  # @!attribute [rw] double_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DoubleValueSpec]
  #     The value spec for a 'DOUBLE' parameter.
  # @!attribute [rw] integer_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::IntegerValueSpec]
  #     The value spec for an 'INTEGER' parameter.
  # @!attribute [rw] categorical_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::CategoricalValueSpec]
  #     The value spec for a 'CATEGORICAL' parameter.
  # @!attribute [rw] discrete_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DiscreteValueSpec]
  #     The value spec for a 'DISCRETE' parameter.
  # @!attribute [rw] parameter_id
  #   @return [::String]
  #     Required. The ID of the parameter. Must not contain whitespaces and must
  #     be unique amongst all ParameterSpecs.
  # @!attribute [rw] scale_type
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ScaleType]
  #     How the parameter should be scaled.
  #     Leave unset for `CATEGORICAL` parameters.
  # @!attribute [rw] conditional_parameter_specs
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec>]
  #     A conditional parameter node is active if the parameter's value matches
  #     the conditional node's parent_value_condition.
  #
  #     If two items in conditional_parameter_specs have the same name, they
  #     must have disjoint parent_value_condition.
  class ParameterSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Value specification for a parameter in `DOUBLE` type.
    # @!attribute [rw] min_value
    #   @return [::Float]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Float]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DOUBLE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DoubleValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `INTEGER` type.
    # @!attribute [rw] min_value
    #   @return [::Integer]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Integer]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Integer]
    #     A default value for an `INTEGER` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class IntegerValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `CATEGORICAL` type.
    # @!attribute [rw] values
    #   @return [::Array<::String>]
    #     Required. The list of possible categories.
    # @!attribute [rw] default_value
    #   @return [::String]
    #     A default value for a `CATEGORICAL` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class CategoricalValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `DISCRETE` type.
    # @!attribute [rw] values
    #   @return [::Array<::Float>]
    #     Required. A list of possible values.
    #     The list should be in increasing order and at least 1e-10 apart.
    #     For instance, this parameter might have possible settings of 1.5, 2.5,
    #     and 4.0. This list should not contain more than 1,000 values.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DISCRETE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.  It automatically rounds to the
    #     nearest feasible discrete point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DiscreteValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Represents a parameter spec with condition from its parent parameter.
    # @!attribute [rw] parent_discrete_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::DiscreteValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `DISCRETE` type.
    # @!attribute [rw] parent_int_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::IntValueCondition]
    #     The spec for matching values from a parent parameter of `INTEGER`
    #     type.
    # @!attribute [rw] parent_categorical_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::CategoricalValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `CATEGORICAL` type.
    # @!attribute [rw] parameter_spec
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec]
    #     Required. The spec for a conditional parameter.
    class ConditionalParameterSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Represents the spec to match discrete values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Float>]
      #     Required. Matches values of the parent parameter of 'DISCRETE' type.
      #     All values must exist in `discrete_value_spec` of parent parameter.
      #
      #     The Epsilon of the value matching is 1e-10.
      class DiscreteValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match integer values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Integer>]
      #     Required. Matches values of the parent parameter of 'INTEGER' type.
      #     All values must lie in `integer_value_spec` of parent parameter.
      class IntValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match categorical values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::String>]
      #     Required. Matches values of the parent parameter of 'CATEGORICAL'
      #     type. All values must exist in `categorical_value_spec` of parent
      #     parameter.
      class CategoricalValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # The type of scaling that should be applied to this parameter.
    module ScaleType
      # By default, no scaling is applied.
      SCALE_TYPE_UNSPECIFIED = 0

      # Scales the feasible space to (0, 1) linearly.
      UNIT_LINEAR_SCALE = 1

      # Scales the feasible space logarithmically to (0, 1). The entire
      # feasible space must be strictly positive.
      UNIT_LOG_SCALE = 2

      # Scales the feasible space "reverse" logarithmically to (0, 1). The
      # result is that values close to the top of the feasible space are spread
      # out more than points near the bottom. The entire feasible space must be
      # strictly positive.
      UNIT_REVERSE_LOG_SCALE = 3
    end
  end

  # The decay curve automated stopping rule builds a Gaussian Process
  # Regressor to predict the final objective value of a Trial based on the
  # already completed Trials and the intermediate measurements of the current
  # Trial. Early stopping is requested for the current Trial if there is very
  # low probability to exceed the optimal value found so far.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}
  #     is used as the x-axis of each Trials Decay Curve. Otherwise,
  #     {::Google::Cloud::AIPlatform::V1::Measurement#step_count Measurement.step_count}
  #     will be used as the x-axis.
  class DecayCurveAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The median automated stopping rule stops a pending Trial if the Trial's
  # best objective_value is strictly below the median 'performance' of all
  # completed Trials reported up to the Trial's last measurement.
  # Currently, 'performance' refers to the running average of the objective
  # values reported by the Trial in each measurement.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if median automated stopping rule applies on
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}.
  #     It means that elapsed_duration field of latest measurement of current
  #     Trial is used to compute median objective value for each completed
  #     Trials.
  class MedianAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Configuration for ConvexAutomatedStoppingSpec.
  # When there are enough completed trials (configured by
  # min_measurement_count), for pending trials with enough measurements and
  # steps, the policy first computes an overestimate of the objective value at
  # max_num_steps according to the slope of the incomplete objective value
  # curve. No prediction can be made if the curve is completely flat. If the
  # overestimation is worse than the best objective value of the completed
  # trials, this pending trial will be early-stopped, but a last measurement
  # will be added to the pending trial with max_num_steps and predicted
  # objective value from the autoregression model.
  # @!attribute [rw] max_step_count
  #   @return [::Integer]
  #     Steps used in predicting the final objective for early stopped trials. In
  #     general, it's set to be the same as the defined steps in training /
  #     tuning. If not defined, it will learn it from the completed trials. When
  #     use_steps is false, this field is set to the maximum elapsed seconds.
  # @!attribute [rw] min_step_count
  #   @return [::Integer]
  #     Minimum number of steps for a trial to complete. Trials which do not have
  #     a measurement with step_count > min_step_count won't be considered for
  #     early stopping. It's ok to set it to 0, and a trial can be early stopped
  #     at any stage. By default, min_step_count is set to be one-tenth of the
  #     max_step_count.
  #     When use_elapsed_duration is true, this field is set to the minimum
  #     elapsed seconds.
  # @!attribute [rw] min_measurement_count
  #   @return [::Integer]
  #     The minimal number of measurements in a Trial.  Early-stopping checks
  #     will not trigger if less than min_measurement_count+1 completed trials or
  #     pending trials with less than min_measurement_count measurements. If not
  #     defined, the default value is 5.
  # @!attribute [rw] learning_rate_parameter_name
  #   @return [::String]
  #     The hyper-parameter name used in the tuning job that stands for learning
  #     rate. Leave it blank if learning rate is not in a parameter in tuning.
  #     The learning_rate is used to estimate the objective value of the ongoing
  #     trial.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     This bool determines whether or not the rule is applied based on
  #     elapsed_secs or steps. If use_elapsed_duration==false, the early stopping
  #     decision is made according to the predicted objective values according to
  #     the target steps. If use_elapsed_duration==true, elapsed_secs is used
  #     instead of steps. Also, in this case, the parameters max_num_steps and
  #     min_num_steps are overloaded to contain max_elapsed_seconds and
  #     min_elapsed_seconds.
  # @!attribute [rw] update_all_stopped_trials
  #   @return [::Boolean]
  #     ConvexAutomatedStoppingSpec by default only updates the trials that needs
  #     to be early stopped using a newly trained auto-regressive model. When
  #     this flag is set to True, all stopped trials from the beginning are
  #     potentially updated in terms of their `final_measurement`. Also, note
  #     that the training logic of autoregressive models is different in this
  #     case. Enabling this option has shown better results and this may be the
  #     default option in the future.
  class ConvexAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The configuration (stopping conditions) for automated stopping of a Study.
  # Conditions include trial budgets, time budgets, and convergence detection.
  # @!attribute [rw] should_stop_asap
  #   @return [::Google::Protobuf::BoolValue]
  #     If true, a Study enters STOPPING_ASAP whenever it would normally enters
  #     STOPPING state.
  #
  #     The bottom line is: set to true if you want to interrupt on-going
  #     evaluations of Trials as soon as the study stopping condition is met.
  #     (Please see Study.State documentation for the source of truth).
  # @!attribute [rw] minimum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     Each "stopping rule" in this proto specifies an "if" condition. Before
  #     Vizier would generate a new suggestion, it first checks each specified
  #     stopping rule, from top to bottom in this list.
  #     Note that the first few rules (e.g. minimum_runtime_constraint,
  #     min_num_trials) will prevent other stopping rules from being evaluated
  #     until they are met. For example, setting `min_num_trials=5` and
  #     `always_stop_after= 1 hour` means that the Study will ONLY stop after it
  #     has 5 COMPLETED trials, even if more than an hour has passed since its
  #     creation. It follows the first applicable rule (whose "if" condition is
  #     satisfied) to make a stopping decision. If none of the specified rules
  #     are applicable, then Vizier decides that the study should not stop.
  #     If Vizier decides that the study should stop, the study enters
  #     STOPPING state (or STOPPING_ASAP if should_stop_asap = true).
  #     IMPORTANT: The automatic study state transition happens precisely as
  #     described above; that is, deleting trials or updating StudyConfig NEVER
  #     automatically moves the study state back to ACTIVE. If you want to
  #     _resume_ a Study that was stopped, 1) change the stopping conditions if
  #     necessary, 2) activate the study, and then 3) ask for suggestions.
  #     If the specified time or duration has not passed, do not stop the
  #     study.
  # @!attribute [rw] maximum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     If the specified time or duration has passed, stop the study.
  # @!attribute [rw] min_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are fewer than this many COMPLETED trials, do not stop the
  #     study.
  # @!attribute [rw] max_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are more than this many trials, stop the study.
  # @!attribute [rw] max_num_trials_no_progress
  #   @return [::Google::Protobuf::Int32Value]
  #     If the objective value has not improved for this many consecutive
  #     trials, stop the study.
  #
  #     WARNING: Effective only for single-objective studies.
  # @!attribute [rw] max_duration_no_progress
  #   @return [::Google::Protobuf::Duration]
  #     If the objective value has not improved for this much time, stop the
  #     study.
  #
  #     WARNING: Effective only for single-objective studies.
  class StudyStoppingConfig
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The available search algorithms for the Study.
  module Algorithm
    # The default algorithm used by Vertex AI for [hyperparameter
    # tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
    # and [Vertex AI Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
    ALGORITHM_UNSPECIFIED = 0

    # Simple grid search within the feasible space. To use grid search,
    # all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
    GRID_SEARCH = 2

    # Simple random search within the feasible space.
    RANDOM_SEARCH = 3
  end

  # Describes the noise level of the repeated observations.
  #
  # "Noisy" means that the repeated observations with the same Trial parameters
  # may lead to different metric evaluations.
  module ObservationNoise
    # The default noise level chosen by Vertex AI.
    OBSERVATION_NOISE_UNSPECIFIED = 0

    # Vertex AI assumes that the objective function is (nearly)
    # perfectly reproducible, and will never repeat the same Trial
    # parameters.
    LOW = 1

    # Vertex AI will estimate the amount of noise in metric
    # evaluations, it may repeat the same Trial parameters more than once.
    HIGH = 2
  end

  # This indicates which measurement to use if/when the service automatically
  # selects the final measurement from previously reported intermediate
  # measurements. Choose this based on two considerations:
  #  A) Do you expect your measurements to monotonically improve?
  #     If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
  #     situation where your system can "over-train" and you expect the
  #     performance to get better for a while but then start declining,
  #     choose BEST_MEASUREMENT.
  #  B) Are your measurements significantly noisy and/or irreproducible?
  #     If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
  #     may be better to choose LAST_MEASUREMENT.
  #  If both or neither of (A) and (B) apply, it doesn't matter which
  #  selection type is chosen.
  module MeasurementSelectionType
    # Will be treated as LAST_MEASUREMENT.
    MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0

    # Use the last measurement reported.
    LAST_MEASUREMENT = 1

    # Use the best measurement reported.
    BEST_MEASUREMENT = 2
  end
end

#measurement_selection_type::Google::Cloud::AIPlatform::V1::StudySpec::MeasurementSelectionType

Returns Describe which measurement selection type will be used.

Returns:



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'proto_docs/google/cloud/aiplatform/v1/study.rb', line 250

class StudySpec
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Represents a metric to optimize.
  # @!attribute [rw] metric_id
  #   @return [::String]
  #     Required. The ID of the metric. Must not contain whitespaces and must be
  #     unique amongst all MetricSpecs.
  # @!attribute [rw] goal
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::GoalType]
  #     Required. The optimization goal of the metric.
  # @!attribute [rw] safety_config
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::SafetyMetricConfig]
  #     Used for safe search. In the case, the metric will be a safety
  #     metric. You must provide a separate metric for objective metric.
  class MetricSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Used in safe optimization to specify threshold levels and risk tolerance.
    # @!attribute [rw] safety_threshold
    #   @return [::Float]
    #     Safety threshold (boundary value between safe and unsafe). NOTE that if
    #     you leave SafetyMetricConfig unset, a default value of 0 will be used.
    # @!attribute [rw] desired_min_safe_trials_fraction
    #   @return [::Float]
    #     Desired minimum fraction of safe trials (over total number of trials)
    #     that should be targeted by the algorithm at any time during the
    #     study (best effort). This should be between 0.0 and 1.0 and a value of
    #     0.0 means that there is no minimum and an algorithm proceeds without
    #     targeting any specific fraction. A value of 1.0 means that the
    #     algorithm attempts to only Suggest safe Trials.
    class SafetyMetricConfig
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # The available types of optimization goals.
    module GoalType
      # Goal Type will default to maximize.
      GOAL_TYPE_UNSPECIFIED = 0

      # Maximize the goal metric.
      MAXIMIZE = 1

      # Minimize the goal metric.
      MINIMIZE = 2
    end
  end

  # Represents a single parameter to optimize.
  # @!attribute [rw] double_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DoubleValueSpec]
  #     The value spec for a 'DOUBLE' parameter.
  # @!attribute [rw] integer_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::IntegerValueSpec]
  #     The value spec for an 'INTEGER' parameter.
  # @!attribute [rw] categorical_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::CategoricalValueSpec]
  #     The value spec for a 'CATEGORICAL' parameter.
  # @!attribute [rw] discrete_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DiscreteValueSpec]
  #     The value spec for a 'DISCRETE' parameter.
  # @!attribute [rw] parameter_id
  #   @return [::String]
  #     Required. The ID of the parameter. Must not contain whitespaces and must
  #     be unique amongst all ParameterSpecs.
  # @!attribute [rw] scale_type
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ScaleType]
  #     How the parameter should be scaled.
  #     Leave unset for `CATEGORICAL` parameters.
  # @!attribute [rw] conditional_parameter_specs
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec>]
  #     A conditional parameter node is active if the parameter's value matches
  #     the conditional node's parent_value_condition.
  #
  #     If two items in conditional_parameter_specs have the same name, they
  #     must have disjoint parent_value_condition.
  class ParameterSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Value specification for a parameter in `DOUBLE` type.
    # @!attribute [rw] min_value
    #   @return [::Float]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Float]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DOUBLE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DoubleValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `INTEGER` type.
    # @!attribute [rw] min_value
    #   @return [::Integer]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Integer]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Integer]
    #     A default value for an `INTEGER` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class IntegerValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `CATEGORICAL` type.
    # @!attribute [rw] values
    #   @return [::Array<::String>]
    #     Required. The list of possible categories.
    # @!attribute [rw] default_value
    #   @return [::String]
    #     A default value for a `CATEGORICAL` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class CategoricalValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `DISCRETE` type.
    # @!attribute [rw] values
    #   @return [::Array<::Float>]
    #     Required. A list of possible values.
    #     The list should be in increasing order and at least 1e-10 apart.
    #     For instance, this parameter might have possible settings of 1.5, 2.5,
    #     and 4.0. This list should not contain more than 1,000 values.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DISCRETE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.  It automatically rounds to the
    #     nearest feasible discrete point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DiscreteValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Represents a parameter spec with condition from its parent parameter.
    # @!attribute [rw] parent_discrete_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::DiscreteValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `DISCRETE` type.
    # @!attribute [rw] parent_int_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::IntValueCondition]
    #     The spec for matching values from a parent parameter of `INTEGER`
    #     type.
    # @!attribute [rw] parent_categorical_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::CategoricalValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `CATEGORICAL` type.
    # @!attribute [rw] parameter_spec
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec]
    #     Required. The spec for a conditional parameter.
    class ConditionalParameterSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Represents the spec to match discrete values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Float>]
      #     Required. Matches values of the parent parameter of 'DISCRETE' type.
      #     All values must exist in `discrete_value_spec` of parent parameter.
      #
      #     The Epsilon of the value matching is 1e-10.
      class DiscreteValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match integer values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Integer>]
      #     Required. Matches values of the parent parameter of 'INTEGER' type.
      #     All values must lie in `integer_value_spec` of parent parameter.
      class IntValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match categorical values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::String>]
      #     Required. Matches values of the parent parameter of 'CATEGORICAL'
      #     type. All values must exist in `categorical_value_spec` of parent
      #     parameter.
      class CategoricalValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # The type of scaling that should be applied to this parameter.
    module ScaleType
      # By default, no scaling is applied.
      SCALE_TYPE_UNSPECIFIED = 0

      # Scales the feasible space to (0, 1) linearly.
      UNIT_LINEAR_SCALE = 1

      # Scales the feasible space logarithmically to (0, 1). The entire
      # feasible space must be strictly positive.
      UNIT_LOG_SCALE = 2

      # Scales the feasible space "reverse" logarithmically to (0, 1). The
      # result is that values close to the top of the feasible space are spread
      # out more than points near the bottom. The entire feasible space must be
      # strictly positive.
      UNIT_REVERSE_LOG_SCALE = 3
    end
  end

  # The decay curve automated stopping rule builds a Gaussian Process
  # Regressor to predict the final objective value of a Trial based on the
  # already completed Trials and the intermediate measurements of the current
  # Trial. Early stopping is requested for the current Trial if there is very
  # low probability to exceed the optimal value found so far.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}
  #     is used as the x-axis of each Trials Decay Curve. Otherwise,
  #     {::Google::Cloud::AIPlatform::V1::Measurement#step_count Measurement.step_count}
  #     will be used as the x-axis.
  class DecayCurveAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The median automated stopping rule stops a pending Trial if the Trial's
  # best objective_value is strictly below the median 'performance' of all
  # completed Trials reported up to the Trial's last measurement.
  # Currently, 'performance' refers to the running average of the objective
  # values reported by the Trial in each measurement.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if median automated stopping rule applies on
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}.
  #     It means that elapsed_duration field of latest measurement of current
  #     Trial is used to compute median objective value for each completed
  #     Trials.
  class MedianAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Configuration for ConvexAutomatedStoppingSpec.
  # When there are enough completed trials (configured by
  # min_measurement_count), for pending trials with enough measurements and
  # steps, the policy first computes an overestimate of the objective value at
  # max_num_steps according to the slope of the incomplete objective value
  # curve. No prediction can be made if the curve is completely flat. If the
  # overestimation is worse than the best objective value of the completed
  # trials, this pending trial will be early-stopped, but a last measurement
  # will be added to the pending trial with max_num_steps and predicted
  # objective value from the autoregression model.
  # @!attribute [rw] max_step_count
  #   @return [::Integer]
  #     Steps used in predicting the final objective for early stopped trials. In
  #     general, it's set to be the same as the defined steps in training /
  #     tuning. If not defined, it will learn it from the completed trials. When
  #     use_steps is false, this field is set to the maximum elapsed seconds.
  # @!attribute [rw] min_step_count
  #   @return [::Integer]
  #     Minimum number of steps for a trial to complete. Trials which do not have
  #     a measurement with step_count > min_step_count won't be considered for
  #     early stopping. It's ok to set it to 0, and a trial can be early stopped
  #     at any stage. By default, min_step_count is set to be one-tenth of the
  #     max_step_count.
  #     When use_elapsed_duration is true, this field is set to the minimum
  #     elapsed seconds.
  # @!attribute [rw] min_measurement_count
  #   @return [::Integer]
  #     The minimal number of measurements in a Trial.  Early-stopping checks
  #     will not trigger if less than min_measurement_count+1 completed trials or
  #     pending trials with less than min_measurement_count measurements. If not
  #     defined, the default value is 5.
  # @!attribute [rw] learning_rate_parameter_name
  #   @return [::String]
  #     The hyper-parameter name used in the tuning job that stands for learning
  #     rate. Leave it blank if learning rate is not in a parameter in tuning.
  #     The learning_rate is used to estimate the objective value of the ongoing
  #     trial.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     This bool determines whether or not the rule is applied based on
  #     elapsed_secs or steps. If use_elapsed_duration==false, the early stopping
  #     decision is made according to the predicted objective values according to
  #     the target steps. If use_elapsed_duration==true, elapsed_secs is used
  #     instead of steps. Also, in this case, the parameters max_num_steps and
  #     min_num_steps are overloaded to contain max_elapsed_seconds and
  #     min_elapsed_seconds.
  # @!attribute [rw] update_all_stopped_trials
  #   @return [::Boolean]
  #     ConvexAutomatedStoppingSpec by default only updates the trials that needs
  #     to be early stopped using a newly trained auto-regressive model. When
  #     this flag is set to True, all stopped trials from the beginning are
  #     potentially updated in terms of their `final_measurement`. Also, note
  #     that the training logic of autoregressive models is different in this
  #     case. Enabling this option has shown better results and this may be the
  #     default option in the future.
  class ConvexAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The configuration (stopping conditions) for automated stopping of a Study.
  # Conditions include trial budgets, time budgets, and convergence detection.
  # @!attribute [rw] should_stop_asap
  #   @return [::Google::Protobuf::BoolValue]
  #     If true, a Study enters STOPPING_ASAP whenever it would normally enters
  #     STOPPING state.
  #
  #     The bottom line is: set to true if you want to interrupt on-going
  #     evaluations of Trials as soon as the study stopping condition is met.
  #     (Please see Study.State documentation for the source of truth).
  # @!attribute [rw] minimum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     Each "stopping rule" in this proto specifies an "if" condition. Before
  #     Vizier would generate a new suggestion, it first checks each specified
  #     stopping rule, from top to bottom in this list.
  #     Note that the first few rules (e.g. minimum_runtime_constraint,
  #     min_num_trials) will prevent other stopping rules from being evaluated
  #     until they are met. For example, setting `min_num_trials=5` and
  #     `always_stop_after= 1 hour` means that the Study will ONLY stop after it
  #     has 5 COMPLETED trials, even if more than an hour has passed since its
  #     creation. It follows the first applicable rule (whose "if" condition is
  #     satisfied) to make a stopping decision. If none of the specified rules
  #     are applicable, then Vizier decides that the study should not stop.
  #     If Vizier decides that the study should stop, the study enters
  #     STOPPING state (or STOPPING_ASAP if should_stop_asap = true).
  #     IMPORTANT: The automatic study state transition happens precisely as
  #     described above; that is, deleting trials or updating StudyConfig NEVER
  #     automatically moves the study state back to ACTIVE. If you want to
  #     _resume_ a Study that was stopped, 1) change the stopping conditions if
  #     necessary, 2) activate the study, and then 3) ask for suggestions.
  #     If the specified time or duration has not passed, do not stop the
  #     study.
  # @!attribute [rw] maximum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     If the specified time or duration has passed, stop the study.
  # @!attribute [rw] min_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are fewer than this many COMPLETED trials, do not stop the
  #     study.
  # @!attribute [rw] max_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are more than this many trials, stop the study.
  # @!attribute [rw] max_num_trials_no_progress
  #   @return [::Google::Protobuf::Int32Value]
  #     If the objective value has not improved for this many consecutive
  #     trials, stop the study.
  #
  #     WARNING: Effective only for single-objective studies.
  # @!attribute [rw] max_duration_no_progress
  #   @return [::Google::Protobuf::Duration]
  #     If the objective value has not improved for this much time, stop the
  #     study.
  #
  #     WARNING: Effective only for single-objective studies.
  class StudyStoppingConfig
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The available search algorithms for the Study.
  module Algorithm
    # The default algorithm used by Vertex AI for [hyperparameter
    # tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
    # and [Vertex AI Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
    ALGORITHM_UNSPECIFIED = 0

    # Simple grid search within the feasible space. To use grid search,
    # all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
    GRID_SEARCH = 2

    # Simple random search within the feasible space.
    RANDOM_SEARCH = 3
  end

  # Describes the noise level of the repeated observations.
  #
  # "Noisy" means that the repeated observations with the same Trial parameters
  # may lead to different metric evaluations.
  module ObservationNoise
    # The default noise level chosen by Vertex AI.
    OBSERVATION_NOISE_UNSPECIFIED = 0

    # Vertex AI assumes that the objective function is (nearly)
    # perfectly reproducible, and will never repeat the same Trial
    # parameters.
    LOW = 1

    # Vertex AI will estimate the amount of noise in metric
    # evaluations, it may repeat the same Trial parameters more than once.
    HIGH = 2
  end

  # This indicates which measurement to use if/when the service automatically
  # selects the final measurement from previously reported intermediate
  # measurements. Choose this based on two considerations:
  #  A) Do you expect your measurements to monotonically improve?
  #     If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
  #     situation where your system can "over-train" and you expect the
  #     performance to get better for a while but then start declining,
  #     choose BEST_MEASUREMENT.
  #  B) Are your measurements significantly noisy and/or irreproducible?
  #     If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
  #     may be better to choose LAST_MEASUREMENT.
  #  If both or neither of (A) and (B) apply, it doesn't matter which
  #  selection type is chosen.
  module MeasurementSelectionType
    # Will be treated as LAST_MEASUREMENT.
    MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0

    # Use the last measurement reported.
    LAST_MEASUREMENT = 1

    # Use the best measurement reported.
    BEST_MEASUREMENT = 2
  end
end

#median_automated_stopping_spec::Google::Cloud::AIPlatform::V1::StudySpec::MedianAutomatedStoppingSpec

Returns The automated early stopping spec using median rule.

Returns:



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'proto_docs/google/cloud/aiplatform/v1/study.rb', line 250

class StudySpec
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Represents a metric to optimize.
  # @!attribute [rw] metric_id
  #   @return [::String]
  #     Required. The ID of the metric. Must not contain whitespaces and must be
  #     unique amongst all MetricSpecs.
  # @!attribute [rw] goal
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::GoalType]
  #     Required. The optimization goal of the metric.
  # @!attribute [rw] safety_config
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::SafetyMetricConfig]
  #     Used for safe search. In the case, the metric will be a safety
  #     metric. You must provide a separate metric for objective metric.
  class MetricSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Used in safe optimization to specify threshold levels and risk tolerance.
    # @!attribute [rw] safety_threshold
    #   @return [::Float]
    #     Safety threshold (boundary value between safe and unsafe). NOTE that if
    #     you leave SafetyMetricConfig unset, a default value of 0 will be used.
    # @!attribute [rw] desired_min_safe_trials_fraction
    #   @return [::Float]
    #     Desired minimum fraction of safe trials (over total number of trials)
    #     that should be targeted by the algorithm at any time during the
    #     study (best effort). This should be between 0.0 and 1.0 and a value of
    #     0.0 means that there is no minimum and an algorithm proceeds without
    #     targeting any specific fraction. A value of 1.0 means that the
    #     algorithm attempts to only Suggest safe Trials.
    class SafetyMetricConfig
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # The available types of optimization goals.
    module GoalType
      # Goal Type will default to maximize.
      GOAL_TYPE_UNSPECIFIED = 0

      # Maximize the goal metric.
      MAXIMIZE = 1

      # Minimize the goal metric.
      MINIMIZE = 2
    end
  end

  # Represents a single parameter to optimize.
  # @!attribute [rw] double_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DoubleValueSpec]
  #     The value spec for a 'DOUBLE' parameter.
  # @!attribute [rw] integer_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::IntegerValueSpec]
  #     The value spec for an 'INTEGER' parameter.
  # @!attribute [rw] categorical_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::CategoricalValueSpec]
  #     The value spec for a 'CATEGORICAL' parameter.
  # @!attribute [rw] discrete_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DiscreteValueSpec]
  #     The value spec for a 'DISCRETE' parameter.
  # @!attribute [rw] parameter_id
  #   @return [::String]
  #     Required. The ID of the parameter. Must not contain whitespaces and must
  #     be unique amongst all ParameterSpecs.
  # @!attribute [rw] scale_type
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ScaleType]
  #     How the parameter should be scaled.
  #     Leave unset for `CATEGORICAL` parameters.
  # @!attribute [rw] conditional_parameter_specs
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec>]
  #     A conditional parameter node is active if the parameter's value matches
  #     the conditional node's parent_value_condition.
  #
  #     If two items in conditional_parameter_specs have the same name, they
  #     must have disjoint parent_value_condition.
  class ParameterSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Value specification for a parameter in `DOUBLE` type.
    # @!attribute [rw] min_value
    #   @return [::Float]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Float]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DOUBLE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DoubleValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `INTEGER` type.
    # @!attribute [rw] min_value
    #   @return [::Integer]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Integer]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Integer]
    #     A default value for an `INTEGER` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class IntegerValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `CATEGORICAL` type.
    # @!attribute [rw] values
    #   @return [::Array<::String>]
    #     Required. The list of possible categories.
    # @!attribute [rw] default_value
    #   @return [::String]
    #     A default value for a `CATEGORICAL` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class CategoricalValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `DISCRETE` type.
    # @!attribute [rw] values
    #   @return [::Array<::Float>]
    #     Required. A list of possible values.
    #     The list should be in increasing order and at least 1e-10 apart.
    #     For instance, this parameter might have possible settings of 1.5, 2.5,
    #     and 4.0. This list should not contain more than 1,000 values.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DISCRETE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.  It automatically rounds to the
    #     nearest feasible discrete point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DiscreteValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Represents a parameter spec with condition from its parent parameter.
    # @!attribute [rw] parent_discrete_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::DiscreteValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `DISCRETE` type.
    # @!attribute [rw] parent_int_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::IntValueCondition]
    #     The spec for matching values from a parent parameter of `INTEGER`
    #     type.
    # @!attribute [rw] parent_categorical_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::CategoricalValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `CATEGORICAL` type.
    # @!attribute [rw] parameter_spec
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec]
    #     Required. The spec for a conditional parameter.
    class ConditionalParameterSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Represents the spec to match discrete values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Float>]
      #     Required. Matches values of the parent parameter of 'DISCRETE' type.
      #     All values must exist in `discrete_value_spec` of parent parameter.
      #
      #     The Epsilon of the value matching is 1e-10.
      class DiscreteValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match integer values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Integer>]
      #     Required. Matches values of the parent parameter of 'INTEGER' type.
      #     All values must lie in `integer_value_spec` of parent parameter.
      class IntValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match categorical values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::String>]
      #     Required. Matches values of the parent parameter of 'CATEGORICAL'
      #     type. All values must exist in `categorical_value_spec` of parent
      #     parameter.
      class CategoricalValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # The type of scaling that should be applied to this parameter.
    module ScaleType
      # By default, no scaling is applied.
      SCALE_TYPE_UNSPECIFIED = 0

      # Scales the feasible space to (0, 1) linearly.
      UNIT_LINEAR_SCALE = 1

      # Scales the feasible space logarithmically to (0, 1). The entire
      # feasible space must be strictly positive.
      UNIT_LOG_SCALE = 2

      # Scales the feasible space "reverse" logarithmically to (0, 1). The
      # result is that values close to the top of the feasible space are spread
      # out more than points near the bottom. The entire feasible space must be
      # strictly positive.
      UNIT_REVERSE_LOG_SCALE = 3
    end
  end

  # The decay curve automated stopping rule builds a Gaussian Process
  # Regressor to predict the final objective value of a Trial based on the
  # already completed Trials and the intermediate measurements of the current
  # Trial. Early stopping is requested for the current Trial if there is very
  # low probability to exceed the optimal value found so far.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}
  #     is used as the x-axis of each Trials Decay Curve. Otherwise,
  #     {::Google::Cloud::AIPlatform::V1::Measurement#step_count Measurement.step_count}
  #     will be used as the x-axis.
  class DecayCurveAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The median automated stopping rule stops a pending Trial if the Trial's
  # best objective_value is strictly below the median 'performance' of all
  # completed Trials reported up to the Trial's last measurement.
  # Currently, 'performance' refers to the running average of the objective
  # values reported by the Trial in each measurement.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if median automated stopping rule applies on
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}.
  #     It means that elapsed_duration field of latest measurement of current
  #     Trial is used to compute median objective value for each completed
  #     Trials.
  class MedianAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Configuration for ConvexAutomatedStoppingSpec.
  # When there are enough completed trials (configured by
  # min_measurement_count), for pending trials with enough measurements and
  # steps, the policy first computes an overestimate of the objective value at
  # max_num_steps according to the slope of the incomplete objective value
  # curve. No prediction can be made if the curve is completely flat. If the
  # overestimation is worse than the best objective value of the completed
  # trials, this pending trial will be early-stopped, but a last measurement
  # will be added to the pending trial with max_num_steps and predicted
  # objective value from the autoregression model.
  # @!attribute [rw] max_step_count
  #   @return [::Integer]
  #     Steps used in predicting the final objective for early stopped trials. In
  #     general, it's set to be the same as the defined steps in training /
  #     tuning. If not defined, it will learn it from the completed trials. When
  #     use_steps is false, this field is set to the maximum elapsed seconds.
  # @!attribute [rw] min_step_count
  #   @return [::Integer]
  #     Minimum number of steps for a trial to complete. Trials which do not have
  #     a measurement with step_count > min_step_count won't be considered for
  #     early stopping. It's ok to set it to 0, and a trial can be early stopped
  #     at any stage. By default, min_step_count is set to be one-tenth of the
  #     max_step_count.
  #     When use_elapsed_duration is true, this field is set to the minimum
  #     elapsed seconds.
  # @!attribute [rw] min_measurement_count
  #   @return [::Integer]
  #     The minimal number of measurements in a Trial.  Early-stopping checks
  #     will not trigger if less than min_measurement_count+1 completed trials or
  #     pending trials with less than min_measurement_count measurements. If not
  #     defined, the default value is 5.
  # @!attribute [rw] learning_rate_parameter_name
  #   @return [::String]
  #     The hyper-parameter name used in the tuning job that stands for learning
  #     rate. Leave it blank if learning rate is not in a parameter in tuning.
  #     The learning_rate is used to estimate the objective value of the ongoing
  #     trial.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     This bool determines whether or not the rule is applied based on
  #     elapsed_secs or steps. If use_elapsed_duration==false, the early stopping
  #     decision is made according to the predicted objective values according to
  #     the target steps. If use_elapsed_duration==true, elapsed_secs is used
  #     instead of steps. Also, in this case, the parameters max_num_steps and
  #     min_num_steps are overloaded to contain max_elapsed_seconds and
  #     min_elapsed_seconds.
  # @!attribute [rw] update_all_stopped_trials
  #   @return [::Boolean]
  #     ConvexAutomatedStoppingSpec by default only updates the trials that needs
  #     to be early stopped using a newly trained auto-regressive model. When
  #     this flag is set to True, all stopped trials from the beginning are
  #     potentially updated in terms of their `final_measurement`. Also, note
  #     that the training logic of autoregressive models is different in this
  #     case. Enabling this option has shown better results and this may be the
  #     default option in the future.
  class ConvexAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The configuration (stopping conditions) for automated stopping of a Study.
  # Conditions include trial budgets, time budgets, and convergence detection.
  # @!attribute [rw] should_stop_asap
  #   @return [::Google::Protobuf::BoolValue]
  #     If true, a Study enters STOPPING_ASAP whenever it would normally enters
  #     STOPPING state.
  #
  #     The bottom line is: set to true if you want to interrupt on-going
  #     evaluations of Trials as soon as the study stopping condition is met.
  #     (Please see Study.State documentation for the source of truth).
  # @!attribute [rw] minimum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     Each "stopping rule" in this proto specifies an "if" condition. Before
  #     Vizier would generate a new suggestion, it first checks each specified
  #     stopping rule, from top to bottom in this list.
  #     Note that the first few rules (e.g. minimum_runtime_constraint,
  #     min_num_trials) will prevent other stopping rules from being evaluated
  #     until they are met. For example, setting `min_num_trials=5` and
  #     `always_stop_after= 1 hour` means that the Study will ONLY stop after it
  #     has 5 COMPLETED trials, even if more than an hour has passed since its
  #     creation. It follows the first applicable rule (whose "if" condition is
  #     satisfied) to make a stopping decision. If none of the specified rules
  #     are applicable, then Vizier decides that the study should not stop.
  #     If Vizier decides that the study should stop, the study enters
  #     STOPPING state (or STOPPING_ASAP if should_stop_asap = true).
  #     IMPORTANT: The automatic study state transition happens precisely as
  #     described above; that is, deleting trials or updating StudyConfig NEVER
  #     automatically moves the study state back to ACTIVE. If you want to
  #     _resume_ a Study that was stopped, 1) change the stopping conditions if
  #     necessary, 2) activate the study, and then 3) ask for suggestions.
  #     If the specified time or duration has not passed, do not stop the
  #     study.
  # @!attribute [rw] maximum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     If the specified time or duration has passed, stop the study.
  # @!attribute [rw] min_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are fewer than this many COMPLETED trials, do not stop the
  #     study.
  # @!attribute [rw] max_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are more than this many trials, stop the study.
  # @!attribute [rw] max_num_trials_no_progress
  #   @return [::Google::Protobuf::Int32Value]
  #     If the objective value has not improved for this many consecutive
  #     trials, stop the study.
  #
  #     WARNING: Effective only for single-objective studies.
  # @!attribute [rw] max_duration_no_progress
  #   @return [::Google::Protobuf::Duration]
  #     If the objective value has not improved for this much time, stop the
  #     study.
  #
  #     WARNING: Effective only for single-objective studies.
  class StudyStoppingConfig
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The available search algorithms for the Study.
  module Algorithm
    # The default algorithm used by Vertex AI for [hyperparameter
    # tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
    # and [Vertex AI Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
    ALGORITHM_UNSPECIFIED = 0

    # Simple grid search within the feasible space. To use grid search,
    # all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
    GRID_SEARCH = 2

    # Simple random search within the feasible space.
    RANDOM_SEARCH = 3
  end

  # Describes the noise level of the repeated observations.
  #
  # "Noisy" means that the repeated observations with the same Trial parameters
  # may lead to different metric evaluations.
  module ObservationNoise
    # The default noise level chosen by Vertex AI.
    OBSERVATION_NOISE_UNSPECIFIED = 0

    # Vertex AI assumes that the objective function is (nearly)
    # perfectly reproducible, and will never repeat the same Trial
    # parameters.
    LOW = 1

    # Vertex AI will estimate the amount of noise in metric
    # evaluations, it may repeat the same Trial parameters more than once.
    HIGH = 2
  end

  # This indicates which measurement to use if/when the service automatically
  # selects the final measurement from previously reported intermediate
  # measurements. Choose this based on two considerations:
  #  A) Do you expect your measurements to monotonically improve?
  #     If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
  #     situation where your system can "over-train" and you expect the
  #     performance to get better for a while but then start declining,
  #     choose BEST_MEASUREMENT.
  #  B) Are your measurements significantly noisy and/or irreproducible?
  #     If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
  #     may be better to choose LAST_MEASUREMENT.
  #  If both or neither of (A) and (B) apply, it doesn't matter which
  #  selection type is chosen.
  module MeasurementSelectionType
    # Will be treated as LAST_MEASUREMENT.
    MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0

    # Use the last measurement reported.
    LAST_MEASUREMENT = 1

    # Use the best measurement reported.
    BEST_MEASUREMENT = 2
  end
end

#metrics::Array<::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec>

Returns Required. Metric specs for the Study.

Returns:



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'proto_docs/google/cloud/aiplatform/v1/study.rb', line 250

class StudySpec
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Represents a metric to optimize.
  # @!attribute [rw] metric_id
  #   @return [::String]
  #     Required. The ID of the metric. Must not contain whitespaces and must be
  #     unique amongst all MetricSpecs.
  # @!attribute [rw] goal
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::GoalType]
  #     Required. The optimization goal of the metric.
  # @!attribute [rw] safety_config
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::SafetyMetricConfig]
  #     Used for safe search. In the case, the metric will be a safety
  #     metric. You must provide a separate metric for objective metric.
  class MetricSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Used in safe optimization to specify threshold levels and risk tolerance.
    # @!attribute [rw] safety_threshold
    #   @return [::Float]
    #     Safety threshold (boundary value between safe and unsafe). NOTE that if
    #     you leave SafetyMetricConfig unset, a default value of 0 will be used.
    # @!attribute [rw] desired_min_safe_trials_fraction
    #   @return [::Float]
    #     Desired minimum fraction of safe trials (over total number of trials)
    #     that should be targeted by the algorithm at any time during the
    #     study (best effort). This should be between 0.0 and 1.0 and a value of
    #     0.0 means that there is no minimum and an algorithm proceeds without
    #     targeting any specific fraction. A value of 1.0 means that the
    #     algorithm attempts to only Suggest safe Trials.
    class SafetyMetricConfig
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # The available types of optimization goals.
    module GoalType
      # Goal Type will default to maximize.
      GOAL_TYPE_UNSPECIFIED = 0

      # Maximize the goal metric.
      MAXIMIZE = 1

      # Minimize the goal metric.
      MINIMIZE = 2
    end
  end

  # Represents a single parameter to optimize.
  # @!attribute [rw] double_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DoubleValueSpec]
  #     The value spec for a 'DOUBLE' parameter.
  # @!attribute [rw] integer_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::IntegerValueSpec]
  #     The value spec for an 'INTEGER' parameter.
  # @!attribute [rw] categorical_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::CategoricalValueSpec]
  #     The value spec for a 'CATEGORICAL' parameter.
  # @!attribute [rw] discrete_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DiscreteValueSpec]
  #     The value spec for a 'DISCRETE' parameter.
  # @!attribute [rw] parameter_id
  #   @return [::String]
  #     Required. The ID of the parameter. Must not contain whitespaces and must
  #     be unique amongst all ParameterSpecs.
  # @!attribute [rw] scale_type
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ScaleType]
  #     How the parameter should be scaled.
  #     Leave unset for `CATEGORICAL` parameters.
  # @!attribute [rw] conditional_parameter_specs
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec>]
  #     A conditional parameter node is active if the parameter's value matches
  #     the conditional node's parent_value_condition.
  #
  #     If two items in conditional_parameter_specs have the same name, they
  #     must have disjoint parent_value_condition.
  class ParameterSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Value specification for a parameter in `DOUBLE` type.
    # @!attribute [rw] min_value
    #   @return [::Float]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Float]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DOUBLE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DoubleValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `INTEGER` type.
    # @!attribute [rw] min_value
    #   @return [::Integer]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Integer]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Integer]
    #     A default value for an `INTEGER` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class IntegerValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `CATEGORICAL` type.
    # @!attribute [rw] values
    #   @return [::Array<::String>]
    #     Required. The list of possible categories.
    # @!attribute [rw] default_value
    #   @return [::String]
    #     A default value for a `CATEGORICAL` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class CategoricalValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `DISCRETE` type.
    # @!attribute [rw] values
    #   @return [::Array<::Float>]
    #     Required. A list of possible values.
    #     The list should be in increasing order and at least 1e-10 apart.
    #     For instance, this parameter might have possible settings of 1.5, 2.5,
    #     and 4.0. This list should not contain more than 1,000 values.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DISCRETE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.  It automatically rounds to the
    #     nearest feasible discrete point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DiscreteValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Represents a parameter spec with condition from its parent parameter.
    # @!attribute [rw] parent_discrete_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::DiscreteValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `DISCRETE` type.
    # @!attribute [rw] parent_int_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::IntValueCondition]
    #     The spec for matching values from a parent parameter of `INTEGER`
    #     type.
    # @!attribute [rw] parent_categorical_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::CategoricalValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `CATEGORICAL` type.
    # @!attribute [rw] parameter_spec
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec]
    #     Required. The spec for a conditional parameter.
    class ConditionalParameterSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Represents the spec to match discrete values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Float>]
      #     Required. Matches values of the parent parameter of 'DISCRETE' type.
      #     All values must exist in `discrete_value_spec` of parent parameter.
      #
      #     The Epsilon of the value matching is 1e-10.
      class DiscreteValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match integer values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Integer>]
      #     Required. Matches values of the parent parameter of 'INTEGER' type.
      #     All values must lie in `integer_value_spec` of parent parameter.
      class IntValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match categorical values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::String>]
      #     Required. Matches values of the parent parameter of 'CATEGORICAL'
      #     type. All values must exist in `categorical_value_spec` of parent
      #     parameter.
      class CategoricalValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # The type of scaling that should be applied to this parameter.
    module ScaleType
      # By default, no scaling is applied.
      SCALE_TYPE_UNSPECIFIED = 0

      # Scales the feasible space to (0, 1) linearly.
      UNIT_LINEAR_SCALE = 1

      # Scales the feasible space logarithmically to (0, 1). The entire
      # feasible space must be strictly positive.
      UNIT_LOG_SCALE = 2

      # Scales the feasible space "reverse" logarithmically to (0, 1). The
      # result is that values close to the top of the feasible space are spread
      # out more than points near the bottom. The entire feasible space must be
      # strictly positive.
      UNIT_REVERSE_LOG_SCALE = 3
    end
  end

  # The decay curve automated stopping rule builds a Gaussian Process
  # Regressor to predict the final objective value of a Trial based on the
  # already completed Trials and the intermediate measurements of the current
  # Trial. Early stopping is requested for the current Trial if there is very
  # low probability to exceed the optimal value found so far.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}
  #     is used as the x-axis of each Trials Decay Curve. Otherwise,
  #     {::Google::Cloud::AIPlatform::V1::Measurement#step_count Measurement.step_count}
  #     will be used as the x-axis.
  class DecayCurveAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The median automated stopping rule stops a pending Trial if the Trial's
  # best objective_value is strictly below the median 'performance' of all
  # completed Trials reported up to the Trial's last measurement.
  # Currently, 'performance' refers to the running average of the objective
  # values reported by the Trial in each measurement.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if median automated stopping rule applies on
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}.
  #     It means that elapsed_duration field of latest measurement of current
  #     Trial is used to compute median objective value for each completed
  #     Trials.
  class MedianAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Configuration for ConvexAutomatedStoppingSpec.
  # When there are enough completed trials (configured by
  # min_measurement_count), for pending trials with enough measurements and
  # steps, the policy first computes an overestimate of the objective value at
  # max_num_steps according to the slope of the incomplete objective value
  # curve. No prediction can be made if the curve is completely flat. If the
  # overestimation is worse than the best objective value of the completed
  # trials, this pending trial will be early-stopped, but a last measurement
  # will be added to the pending trial with max_num_steps and predicted
  # objective value from the autoregression model.
  # @!attribute [rw] max_step_count
  #   @return [::Integer]
  #     Steps used in predicting the final objective for early stopped trials. In
  #     general, it's set to be the same as the defined steps in training /
  #     tuning. If not defined, it will learn it from the completed trials. When
  #     use_steps is false, this field is set to the maximum elapsed seconds.
  # @!attribute [rw] min_step_count
  #   @return [::Integer]
  #     Minimum number of steps for a trial to complete. Trials which do not have
  #     a measurement with step_count > min_step_count won't be considered for
  #     early stopping. It's ok to set it to 0, and a trial can be early stopped
  #     at any stage. By default, min_step_count is set to be one-tenth of the
  #     max_step_count.
  #     When use_elapsed_duration is true, this field is set to the minimum
  #     elapsed seconds.
  # @!attribute [rw] min_measurement_count
  #   @return [::Integer]
  #     The minimal number of measurements in a Trial.  Early-stopping checks
  #     will not trigger if less than min_measurement_count+1 completed trials or
  #     pending trials with less than min_measurement_count measurements. If not
  #     defined, the default value is 5.
  # @!attribute [rw] learning_rate_parameter_name
  #   @return [::String]
  #     The hyper-parameter name used in the tuning job that stands for learning
  #     rate. Leave it blank if learning rate is not in a parameter in tuning.
  #     The learning_rate is used to estimate the objective value of the ongoing
  #     trial.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     This bool determines whether or not the rule is applied based on
  #     elapsed_secs or steps. If use_elapsed_duration==false, the early stopping
  #     decision is made according to the predicted objective values according to
  #     the target steps. If use_elapsed_duration==true, elapsed_secs is used
  #     instead of steps. Also, in this case, the parameters max_num_steps and
  #     min_num_steps are overloaded to contain max_elapsed_seconds and
  #     min_elapsed_seconds.
  # @!attribute [rw] update_all_stopped_trials
  #   @return [::Boolean]
  #     ConvexAutomatedStoppingSpec by default only updates the trials that needs
  #     to be early stopped using a newly trained auto-regressive model. When
  #     this flag is set to True, all stopped trials from the beginning are
  #     potentially updated in terms of their `final_measurement`. Also, note
  #     that the training logic of autoregressive models is different in this
  #     case. Enabling this option has shown better results and this may be the
  #     default option in the future.
  class ConvexAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The configuration (stopping conditions) for automated stopping of a Study.
  # Conditions include trial budgets, time budgets, and convergence detection.
  # @!attribute [rw] should_stop_asap
  #   @return [::Google::Protobuf::BoolValue]
  #     If true, a Study enters STOPPING_ASAP whenever it would normally enters
  #     STOPPING state.
  #
  #     The bottom line is: set to true if you want to interrupt on-going
  #     evaluations of Trials as soon as the study stopping condition is met.
  #     (Please see Study.State documentation for the source of truth).
  # @!attribute [rw] minimum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     Each "stopping rule" in this proto specifies an "if" condition. Before
  #     Vizier would generate a new suggestion, it first checks each specified
  #     stopping rule, from top to bottom in this list.
  #     Note that the first few rules (e.g. minimum_runtime_constraint,
  #     min_num_trials) will prevent other stopping rules from being evaluated
  #     until they are met. For example, setting `min_num_trials=5` and
  #     `always_stop_after= 1 hour` means that the Study will ONLY stop after it
  #     has 5 COMPLETED trials, even if more than an hour has passed since its
  #     creation. It follows the first applicable rule (whose "if" condition is
  #     satisfied) to make a stopping decision. If none of the specified rules
  #     are applicable, then Vizier decides that the study should not stop.
  #     If Vizier decides that the study should stop, the study enters
  #     STOPPING state (or STOPPING_ASAP if should_stop_asap = true).
  #     IMPORTANT: The automatic study state transition happens precisely as
  #     described above; that is, deleting trials or updating StudyConfig NEVER
  #     automatically moves the study state back to ACTIVE. If you want to
  #     _resume_ a Study that was stopped, 1) change the stopping conditions if
  #     necessary, 2) activate the study, and then 3) ask for suggestions.
  #     If the specified time or duration has not passed, do not stop the
  #     study.
  # @!attribute [rw] maximum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     If the specified time or duration has passed, stop the study.
  # @!attribute [rw] min_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are fewer than this many COMPLETED trials, do not stop the
  #     study.
  # @!attribute [rw] max_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are more than this many trials, stop the study.
  # @!attribute [rw] max_num_trials_no_progress
  #   @return [::Google::Protobuf::Int32Value]
  #     If the objective value has not improved for this many consecutive
  #     trials, stop the study.
  #
  #     WARNING: Effective only for single-objective studies.
  # @!attribute [rw] max_duration_no_progress
  #   @return [::Google::Protobuf::Duration]
  #     If the objective value has not improved for this much time, stop the
  #     study.
  #
  #     WARNING: Effective only for single-objective studies.
  class StudyStoppingConfig
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The available search algorithms for the Study.
  module Algorithm
    # The default algorithm used by Vertex AI for [hyperparameter
    # tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
    # and [Vertex AI Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
    ALGORITHM_UNSPECIFIED = 0

    # Simple grid search within the feasible space. To use grid search,
    # all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
    GRID_SEARCH = 2

    # Simple random search within the feasible space.
    RANDOM_SEARCH = 3
  end

  # Describes the noise level of the repeated observations.
  #
  # "Noisy" means that the repeated observations with the same Trial parameters
  # may lead to different metric evaluations.
  module ObservationNoise
    # The default noise level chosen by Vertex AI.
    OBSERVATION_NOISE_UNSPECIFIED = 0

    # Vertex AI assumes that the objective function is (nearly)
    # perfectly reproducible, and will never repeat the same Trial
    # parameters.
    LOW = 1

    # Vertex AI will estimate the amount of noise in metric
    # evaluations, it may repeat the same Trial parameters more than once.
    HIGH = 2
  end

  # This indicates which measurement to use if/when the service automatically
  # selects the final measurement from previously reported intermediate
  # measurements. Choose this based on two considerations:
  #  A) Do you expect your measurements to monotonically improve?
  #     If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
  #     situation where your system can "over-train" and you expect the
  #     performance to get better for a while but then start declining,
  #     choose BEST_MEASUREMENT.
  #  B) Are your measurements significantly noisy and/or irreproducible?
  #     If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
  #     may be better to choose LAST_MEASUREMENT.
  #  If both or neither of (A) and (B) apply, it doesn't matter which
  #  selection type is chosen.
  module MeasurementSelectionType
    # Will be treated as LAST_MEASUREMENT.
    MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0

    # Use the last measurement reported.
    LAST_MEASUREMENT = 1

    # Use the best measurement reported.
    BEST_MEASUREMENT = 2
  end
end

#observation_noise::Google::Cloud::AIPlatform::V1::StudySpec::ObservationNoise

Returns The observation noise level of the study. Currently only supported by the Vertex AI Vizier service. Not supported by HyperparameterTuningJob or TrainingPipeline.

Returns:



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'proto_docs/google/cloud/aiplatform/v1/study.rb', line 250

class StudySpec
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Represents a metric to optimize.
  # @!attribute [rw] metric_id
  #   @return [::String]
  #     Required. The ID of the metric. Must not contain whitespaces and must be
  #     unique amongst all MetricSpecs.
  # @!attribute [rw] goal
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::GoalType]
  #     Required. The optimization goal of the metric.
  # @!attribute [rw] safety_config
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::SafetyMetricConfig]
  #     Used for safe search. In the case, the metric will be a safety
  #     metric. You must provide a separate metric for objective metric.
  class MetricSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Used in safe optimization to specify threshold levels and risk tolerance.
    # @!attribute [rw] safety_threshold
    #   @return [::Float]
    #     Safety threshold (boundary value between safe and unsafe). NOTE that if
    #     you leave SafetyMetricConfig unset, a default value of 0 will be used.
    # @!attribute [rw] desired_min_safe_trials_fraction
    #   @return [::Float]
    #     Desired minimum fraction of safe trials (over total number of trials)
    #     that should be targeted by the algorithm at any time during the
    #     study (best effort). This should be between 0.0 and 1.0 and a value of
    #     0.0 means that there is no minimum and an algorithm proceeds without
    #     targeting any specific fraction. A value of 1.0 means that the
    #     algorithm attempts to only Suggest safe Trials.
    class SafetyMetricConfig
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # The available types of optimization goals.
    module GoalType
      # Goal Type will default to maximize.
      GOAL_TYPE_UNSPECIFIED = 0

      # Maximize the goal metric.
      MAXIMIZE = 1

      # Minimize the goal metric.
      MINIMIZE = 2
    end
  end

  # Represents a single parameter to optimize.
  # @!attribute [rw] double_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DoubleValueSpec]
  #     The value spec for a 'DOUBLE' parameter.
  # @!attribute [rw] integer_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::IntegerValueSpec]
  #     The value spec for an 'INTEGER' parameter.
  # @!attribute [rw] categorical_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::CategoricalValueSpec]
  #     The value spec for a 'CATEGORICAL' parameter.
  # @!attribute [rw] discrete_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DiscreteValueSpec]
  #     The value spec for a 'DISCRETE' parameter.
  # @!attribute [rw] parameter_id
  #   @return [::String]
  #     Required. The ID of the parameter. Must not contain whitespaces and must
  #     be unique amongst all ParameterSpecs.
  # @!attribute [rw] scale_type
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ScaleType]
  #     How the parameter should be scaled.
  #     Leave unset for `CATEGORICAL` parameters.
  # @!attribute [rw] conditional_parameter_specs
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec>]
  #     A conditional parameter node is active if the parameter's value matches
  #     the conditional node's parent_value_condition.
  #
  #     If two items in conditional_parameter_specs have the same name, they
  #     must have disjoint parent_value_condition.
  class ParameterSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Value specification for a parameter in `DOUBLE` type.
    # @!attribute [rw] min_value
    #   @return [::Float]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Float]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DOUBLE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DoubleValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `INTEGER` type.
    # @!attribute [rw] min_value
    #   @return [::Integer]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Integer]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Integer]
    #     A default value for an `INTEGER` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class IntegerValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `CATEGORICAL` type.
    # @!attribute [rw] values
    #   @return [::Array<::String>]
    #     Required. The list of possible categories.
    # @!attribute [rw] default_value
    #   @return [::String]
    #     A default value for a `CATEGORICAL` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class CategoricalValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `DISCRETE` type.
    # @!attribute [rw] values
    #   @return [::Array<::Float>]
    #     Required. A list of possible values.
    #     The list should be in increasing order and at least 1e-10 apart.
    #     For instance, this parameter might have possible settings of 1.5, 2.5,
    #     and 4.0. This list should not contain more than 1,000 values.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DISCRETE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.  It automatically rounds to the
    #     nearest feasible discrete point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DiscreteValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Represents a parameter spec with condition from its parent parameter.
    # @!attribute [rw] parent_discrete_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::DiscreteValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `DISCRETE` type.
    # @!attribute [rw] parent_int_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::IntValueCondition]
    #     The spec for matching values from a parent parameter of `INTEGER`
    #     type.
    # @!attribute [rw] parent_categorical_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::CategoricalValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `CATEGORICAL` type.
    # @!attribute [rw] parameter_spec
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec]
    #     Required. The spec for a conditional parameter.
    class ConditionalParameterSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Represents the spec to match discrete values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Float>]
      #     Required. Matches values of the parent parameter of 'DISCRETE' type.
      #     All values must exist in `discrete_value_spec` of parent parameter.
      #
      #     The Epsilon of the value matching is 1e-10.
      class DiscreteValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match integer values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Integer>]
      #     Required. Matches values of the parent parameter of 'INTEGER' type.
      #     All values must lie in `integer_value_spec` of parent parameter.
      class IntValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match categorical values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::String>]
      #     Required. Matches values of the parent parameter of 'CATEGORICAL'
      #     type. All values must exist in `categorical_value_spec` of parent
      #     parameter.
      class CategoricalValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # The type of scaling that should be applied to this parameter.
    module ScaleType
      # By default, no scaling is applied.
      SCALE_TYPE_UNSPECIFIED = 0

      # Scales the feasible space to (0, 1) linearly.
      UNIT_LINEAR_SCALE = 1

      # Scales the feasible space logarithmically to (0, 1). The entire
      # feasible space must be strictly positive.
      UNIT_LOG_SCALE = 2

      # Scales the feasible space "reverse" logarithmically to (0, 1). The
      # result is that values close to the top of the feasible space are spread
      # out more than points near the bottom. The entire feasible space must be
      # strictly positive.
      UNIT_REVERSE_LOG_SCALE = 3
    end
  end

  # The decay curve automated stopping rule builds a Gaussian Process
  # Regressor to predict the final objective value of a Trial based on the
  # already completed Trials and the intermediate measurements of the current
  # Trial. Early stopping is requested for the current Trial if there is very
  # low probability to exceed the optimal value found so far.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}
  #     is used as the x-axis of each Trials Decay Curve. Otherwise,
  #     {::Google::Cloud::AIPlatform::V1::Measurement#step_count Measurement.step_count}
  #     will be used as the x-axis.
  class DecayCurveAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The median automated stopping rule stops a pending Trial if the Trial's
  # best objective_value is strictly below the median 'performance' of all
  # completed Trials reported up to the Trial's last measurement.
  # Currently, 'performance' refers to the running average of the objective
  # values reported by the Trial in each measurement.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if median automated stopping rule applies on
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}.
  #     It means that elapsed_duration field of latest measurement of current
  #     Trial is used to compute median objective value for each completed
  #     Trials.
  class MedianAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Configuration for ConvexAutomatedStoppingSpec.
  # When there are enough completed trials (configured by
  # min_measurement_count), for pending trials with enough measurements and
  # steps, the policy first computes an overestimate of the objective value at
  # max_num_steps according to the slope of the incomplete objective value
  # curve. No prediction can be made if the curve is completely flat. If the
  # overestimation is worse than the best objective value of the completed
  # trials, this pending trial will be early-stopped, but a last measurement
  # will be added to the pending trial with max_num_steps and predicted
  # objective value from the autoregression model.
  # @!attribute [rw] max_step_count
  #   @return [::Integer]
  #     Steps used in predicting the final objective for early stopped trials. In
  #     general, it's set to be the same as the defined steps in training /
  #     tuning. If not defined, it will learn it from the completed trials. When
  #     use_steps is false, this field is set to the maximum elapsed seconds.
  # @!attribute [rw] min_step_count
  #   @return [::Integer]
  #     Minimum number of steps for a trial to complete. Trials which do not have
  #     a measurement with step_count > min_step_count won't be considered for
  #     early stopping. It's ok to set it to 0, and a trial can be early stopped
  #     at any stage. By default, min_step_count is set to be one-tenth of the
  #     max_step_count.
  #     When use_elapsed_duration is true, this field is set to the minimum
  #     elapsed seconds.
  # @!attribute [rw] min_measurement_count
  #   @return [::Integer]
  #     The minimal number of measurements in a Trial.  Early-stopping checks
  #     will not trigger if less than min_measurement_count+1 completed trials or
  #     pending trials with less than min_measurement_count measurements. If not
  #     defined, the default value is 5.
  # @!attribute [rw] learning_rate_parameter_name
  #   @return [::String]
  #     The hyper-parameter name used in the tuning job that stands for learning
  #     rate. Leave it blank if learning rate is not in a parameter in tuning.
  #     The learning_rate is used to estimate the objective value of the ongoing
  #     trial.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     This bool determines whether or not the rule is applied based on
  #     elapsed_secs or steps. If use_elapsed_duration==false, the early stopping
  #     decision is made according to the predicted objective values according to
  #     the target steps. If use_elapsed_duration==true, elapsed_secs is used
  #     instead of steps. Also, in this case, the parameters max_num_steps and
  #     min_num_steps are overloaded to contain max_elapsed_seconds and
  #     min_elapsed_seconds.
  # @!attribute [rw] update_all_stopped_trials
  #   @return [::Boolean]
  #     ConvexAutomatedStoppingSpec by default only updates the trials that needs
  #     to be early stopped using a newly trained auto-regressive model. When
  #     this flag is set to True, all stopped trials from the beginning are
  #     potentially updated in terms of their `final_measurement`. Also, note
  #     that the training logic of autoregressive models is different in this
  #     case. Enabling this option has shown better results and this may be the
  #     default option in the future.
  class ConvexAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The configuration (stopping conditions) for automated stopping of a Study.
  # Conditions include trial budgets, time budgets, and convergence detection.
  # @!attribute [rw] should_stop_asap
  #   @return [::Google::Protobuf::BoolValue]
  #     If true, a Study enters STOPPING_ASAP whenever it would normally enters
  #     STOPPING state.
  #
  #     The bottom line is: set to true if you want to interrupt on-going
  #     evaluations of Trials as soon as the study stopping condition is met.
  #     (Please see Study.State documentation for the source of truth).
  # @!attribute [rw] minimum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     Each "stopping rule" in this proto specifies an "if" condition. Before
  #     Vizier would generate a new suggestion, it first checks each specified
  #     stopping rule, from top to bottom in this list.
  #     Note that the first few rules (e.g. minimum_runtime_constraint,
  #     min_num_trials) will prevent other stopping rules from being evaluated
  #     until they are met. For example, setting `min_num_trials=5` and
  #     `always_stop_after= 1 hour` means that the Study will ONLY stop after it
  #     has 5 COMPLETED trials, even if more than an hour has passed since its
  #     creation. It follows the first applicable rule (whose "if" condition is
  #     satisfied) to make a stopping decision. If none of the specified rules
  #     are applicable, then Vizier decides that the study should not stop.
  #     If Vizier decides that the study should stop, the study enters
  #     STOPPING state (or STOPPING_ASAP if should_stop_asap = true).
  #     IMPORTANT: The automatic study state transition happens precisely as
  #     described above; that is, deleting trials or updating StudyConfig NEVER
  #     automatically moves the study state back to ACTIVE. If you want to
  #     _resume_ a Study that was stopped, 1) change the stopping conditions if
  #     necessary, 2) activate the study, and then 3) ask for suggestions.
  #     If the specified time or duration has not passed, do not stop the
  #     study.
  # @!attribute [rw] maximum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     If the specified time or duration has passed, stop the study.
  # @!attribute [rw] min_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are fewer than this many COMPLETED trials, do not stop the
  #     study.
  # @!attribute [rw] max_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are more than this many trials, stop the study.
  # @!attribute [rw] max_num_trials_no_progress
  #   @return [::Google::Protobuf::Int32Value]
  #     If the objective value has not improved for this many consecutive
  #     trials, stop the study.
  #
  #     WARNING: Effective only for single-objective studies.
  # @!attribute [rw] max_duration_no_progress
  #   @return [::Google::Protobuf::Duration]
  #     If the objective value has not improved for this much time, stop the
  #     study.
  #
  #     WARNING: Effective only for single-objective studies.
  class StudyStoppingConfig
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The available search algorithms for the Study.
  module Algorithm
    # The default algorithm used by Vertex AI for [hyperparameter
    # tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
    # and [Vertex AI Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
    ALGORITHM_UNSPECIFIED = 0

    # Simple grid search within the feasible space. To use grid search,
    # all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
    GRID_SEARCH = 2

    # Simple random search within the feasible space.
    RANDOM_SEARCH = 3
  end

  # Describes the noise level of the repeated observations.
  #
  # "Noisy" means that the repeated observations with the same Trial parameters
  # may lead to different metric evaluations.
  module ObservationNoise
    # The default noise level chosen by Vertex AI.
    OBSERVATION_NOISE_UNSPECIFIED = 0

    # Vertex AI assumes that the objective function is (nearly)
    # perfectly reproducible, and will never repeat the same Trial
    # parameters.
    LOW = 1

    # Vertex AI will estimate the amount of noise in metric
    # evaluations, it may repeat the same Trial parameters more than once.
    HIGH = 2
  end

  # This indicates which measurement to use if/when the service automatically
  # selects the final measurement from previously reported intermediate
  # measurements. Choose this based on two considerations:
  #  A) Do you expect your measurements to monotonically improve?
  #     If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
  #     situation where your system can "over-train" and you expect the
  #     performance to get better for a while but then start declining,
  #     choose BEST_MEASUREMENT.
  #  B) Are your measurements significantly noisy and/or irreproducible?
  #     If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
  #     may be better to choose LAST_MEASUREMENT.
  #  If both or neither of (A) and (B) apply, it doesn't matter which
  #  selection type is chosen.
  module MeasurementSelectionType
    # Will be treated as LAST_MEASUREMENT.
    MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0

    # Use the last measurement reported.
    LAST_MEASUREMENT = 1

    # Use the best measurement reported.
    BEST_MEASUREMENT = 2
  end
end

#parameters::Array<::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec>

Returns Required. The set of parameters to tune.

Returns:



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'proto_docs/google/cloud/aiplatform/v1/study.rb', line 250

class StudySpec
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Represents a metric to optimize.
  # @!attribute [rw] metric_id
  #   @return [::String]
  #     Required. The ID of the metric. Must not contain whitespaces and must be
  #     unique amongst all MetricSpecs.
  # @!attribute [rw] goal
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::GoalType]
  #     Required. The optimization goal of the metric.
  # @!attribute [rw] safety_config
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::SafetyMetricConfig]
  #     Used for safe search. In the case, the metric will be a safety
  #     metric. You must provide a separate metric for objective metric.
  class MetricSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Used in safe optimization to specify threshold levels and risk tolerance.
    # @!attribute [rw] safety_threshold
    #   @return [::Float]
    #     Safety threshold (boundary value between safe and unsafe). NOTE that if
    #     you leave SafetyMetricConfig unset, a default value of 0 will be used.
    # @!attribute [rw] desired_min_safe_trials_fraction
    #   @return [::Float]
    #     Desired minimum fraction of safe trials (over total number of trials)
    #     that should be targeted by the algorithm at any time during the
    #     study (best effort). This should be between 0.0 and 1.0 and a value of
    #     0.0 means that there is no minimum and an algorithm proceeds without
    #     targeting any specific fraction. A value of 1.0 means that the
    #     algorithm attempts to only Suggest safe Trials.
    class SafetyMetricConfig
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # The available types of optimization goals.
    module GoalType
      # Goal Type will default to maximize.
      GOAL_TYPE_UNSPECIFIED = 0

      # Maximize the goal metric.
      MAXIMIZE = 1

      # Minimize the goal metric.
      MINIMIZE = 2
    end
  end

  # Represents a single parameter to optimize.
  # @!attribute [rw] double_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DoubleValueSpec]
  #     The value spec for a 'DOUBLE' parameter.
  # @!attribute [rw] integer_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::IntegerValueSpec]
  #     The value spec for an 'INTEGER' parameter.
  # @!attribute [rw] categorical_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::CategoricalValueSpec]
  #     The value spec for a 'CATEGORICAL' parameter.
  # @!attribute [rw] discrete_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DiscreteValueSpec]
  #     The value spec for a 'DISCRETE' parameter.
  # @!attribute [rw] parameter_id
  #   @return [::String]
  #     Required. The ID of the parameter. Must not contain whitespaces and must
  #     be unique amongst all ParameterSpecs.
  # @!attribute [rw] scale_type
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ScaleType]
  #     How the parameter should be scaled.
  #     Leave unset for `CATEGORICAL` parameters.
  # @!attribute [rw] conditional_parameter_specs
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec>]
  #     A conditional parameter node is active if the parameter's value matches
  #     the conditional node's parent_value_condition.
  #
  #     If two items in conditional_parameter_specs have the same name, they
  #     must have disjoint parent_value_condition.
  class ParameterSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Value specification for a parameter in `DOUBLE` type.
    # @!attribute [rw] min_value
    #   @return [::Float]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Float]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DOUBLE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DoubleValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `INTEGER` type.
    # @!attribute [rw] min_value
    #   @return [::Integer]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Integer]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Integer]
    #     A default value for an `INTEGER` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class IntegerValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `CATEGORICAL` type.
    # @!attribute [rw] values
    #   @return [::Array<::String>]
    #     Required. The list of possible categories.
    # @!attribute [rw] default_value
    #   @return [::String]
    #     A default value for a `CATEGORICAL` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class CategoricalValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `DISCRETE` type.
    # @!attribute [rw] values
    #   @return [::Array<::Float>]
    #     Required. A list of possible values.
    #     The list should be in increasing order and at least 1e-10 apart.
    #     For instance, this parameter might have possible settings of 1.5, 2.5,
    #     and 4.0. This list should not contain more than 1,000 values.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DISCRETE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.  It automatically rounds to the
    #     nearest feasible discrete point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DiscreteValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Represents a parameter spec with condition from its parent parameter.
    # @!attribute [rw] parent_discrete_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::DiscreteValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `DISCRETE` type.
    # @!attribute [rw] parent_int_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::IntValueCondition]
    #     The spec for matching values from a parent parameter of `INTEGER`
    #     type.
    # @!attribute [rw] parent_categorical_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::CategoricalValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `CATEGORICAL` type.
    # @!attribute [rw] parameter_spec
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec]
    #     Required. The spec for a conditional parameter.
    class ConditionalParameterSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Represents the spec to match discrete values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Float>]
      #     Required. Matches values of the parent parameter of 'DISCRETE' type.
      #     All values must exist in `discrete_value_spec` of parent parameter.
      #
      #     The Epsilon of the value matching is 1e-10.
      class DiscreteValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match integer values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Integer>]
      #     Required. Matches values of the parent parameter of 'INTEGER' type.
      #     All values must lie in `integer_value_spec` of parent parameter.
      class IntValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match categorical values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::String>]
      #     Required. Matches values of the parent parameter of 'CATEGORICAL'
      #     type. All values must exist in `categorical_value_spec` of parent
      #     parameter.
      class CategoricalValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # The type of scaling that should be applied to this parameter.
    module ScaleType
      # By default, no scaling is applied.
      SCALE_TYPE_UNSPECIFIED = 0

      # Scales the feasible space to (0, 1) linearly.
      UNIT_LINEAR_SCALE = 1

      # Scales the feasible space logarithmically to (0, 1). The entire
      # feasible space must be strictly positive.
      UNIT_LOG_SCALE = 2

      # Scales the feasible space "reverse" logarithmically to (0, 1). The
      # result is that values close to the top of the feasible space are spread
      # out more than points near the bottom. The entire feasible space must be
      # strictly positive.
      UNIT_REVERSE_LOG_SCALE = 3
    end
  end

  # The decay curve automated stopping rule builds a Gaussian Process
  # Regressor to predict the final objective value of a Trial based on the
  # already completed Trials and the intermediate measurements of the current
  # Trial. Early stopping is requested for the current Trial if there is very
  # low probability to exceed the optimal value found so far.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}
  #     is used as the x-axis of each Trials Decay Curve. Otherwise,
  #     {::Google::Cloud::AIPlatform::V1::Measurement#step_count Measurement.step_count}
  #     will be used as the x-axis.
  class DecayCurveAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The median automated stopping rule stops a pending Trial if the Trial's
  # best objective_value is strictly below the median 'performance' of all
  # completed Trials reported up to the Trial's last measurement.
  # Currently, 'performance' refers to the running average of the objective
  # values reported by the Trial in each measurement.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if median automated stopping rule applies on
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}.
  #     It means that elapsed_duration field of latest measurement of current
  #     Trial is used to compute median objective value for each completed
  #     Trials.
  class MedianAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Configuration for ConvexAutomatedStoppingSpec.
  # When there are enough completed trials (configured by
  # min_measurement_count), for pending trials with enough measurements and
  # steps, the policy first computes an overestimate of the objective value at
  # max_num_steps according to the slope of the incomplete objective value
  # curve. No prediction can be made if the curve is completely flat. If the
  # overestimation is worse than the best objective value of the completed
  # trials, this pending trial will be early-stopped, but a last measurement
  # will be added to the pending trial with max_num_steps and predicted
  # objective value from the autoregression model.
  # @!attribute [rw] max_step_count
  #   @return [::Integer]
  #     Steps used in predicting the final objective for early stopped trials. In
  #     general, it's set to be the same as the defined steps in training /
  #     tuning. If not defined, it will learn it from the completed trials. When
  #     use_steps is false, this field is set to the maximum elapsed seconds.
  # @!attribute [rw] min_step_count
  #   @return [::Integer]
  #     Minimum number of steps for a trial to complete. Trials which do not have
  #     a measurement with step_count > min_step_count won't be considered for
  #     early stopping. It's ok to set it to 0, and a trial can be early stopped
  #     at any stage. By default, min_step_count is set to be one-tenth of the
  #     max_step_count.
  #     When use_elapsed_duration is true, this field is set to the minimum
  #     elapsed seconds.
  # @!attribute [rw] min_measurement_count
  #   @return [::Integer]
  #     The minimal number of measurements in a Trial.  Early-stopping checks
  #     will not trigger if less than min_measurement_count+1 completed trials or
  #     pending trials with less than min_measurement_count measurements. If not
  #     defined, the default value is 5.
  # @!attribute [rw] learning_rate_parameter_name
  #   @return [::String]
  #     The hyper-parameter name used in the tuning job that stands for learning
  #     rate. Leave it blank if learning rate is not in a parameter in tuning.
  #     The learning_rate is used to estimate the objective value of the ongoing
  #     trial.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     This bool determines whether or not the rule is applied based on
  #     elapsed_secs or steps. If use_elapsed_duration==false, the early stopping
  #     decision is made according to the predicted objective values according to
  #     the target steps. If use_elapsed_duration==true, elapsed_secs is used
  #     instead of steps. Also, in this case, the parameters max_num_steps and
  #     min_num_steps are overloaded to contain max_elapsed_seconds and
  #     min_elapsed_seconds.
  # @!attribute [rw] update_all_stopped_trials
  #   @return [::Boolean]
  #     ConvexAutomatedStoppingSpec by default only updates the trials that needs
  #     to be early stopped using a newly trained auto-regressive model. When
  #     this flag is set to True, all stopped trials from the beginning are
  #     potentially updated in terms of their `final_measurement`. Also, note
  #     that the training logic of autoregressive models is different in this
  #     case. Enabling this option has shown better results and this may be the
  #     default option in the future.
  class ConvexAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The configuration (stopping conditions) for automated stopping of a Study.
  # Conditions include trial budgets, time budgets, and convergence detection.
  # @!attribute [rw] should_stop_asap
  #   @return [::Google::Protobuf::BoolValue]
  #     If true, a Study enters STOPPING_ASAP whenever it would normally enters
  #     STOPPING state.
  #
  #     The bottom line is: set to true if you want to interrupt on-going
  #     evaluations of Trials as soon as the study stopping condition is met.
  #     (Please see Study.State documentation for the source of truth).
  # @!attribute [rw] minimum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     Each "stopping rule" in this proto specifies an "if" condition. Before
  #     Vizier would generate a new suggestion, it first checks each specified
  #     stopping rule, from top to bottom in this list.
  #     Note that the first few rules (e.g. minimum_runtime_constraint,
  #     min_num_trials) will prevent other stopping rules from being evaluated
  #     until they are met. For example, setting `min_num_trials=5` and
  #     `always_stop_after= 1 hour` means that the Study will ONLY stop after it
  #     has 5 COMPLETED trials, even if more than an hour has passed since its
  #     creation. It follows the first applicable rule (whose "if" condition is
  #     satisfied) to make a stopping decision. If none of the specified rules
  #     are applicable, then Vizier decides that the study should not stop.
  #     If Vizier decides that the study should stop, the study enters
  #     STOPPING state (or STOPPING_ASAP if should_stop_asap = true).
  #     IMPORTANT: The automatic study state transition happens precisely as
  #     described above; that is, deleting trials or updating StudyConfig NEVER
  #     automatically moves the study state back to ACTIVE. If you want to
  #     _resume_ a Study that was stopped, 1) change the stopping conditions if
  #     necessary, 2) activate the study, and then 3) ask for suggestions.
  #     If the specified time or duration has not passed, do not stop the
  #     study.
  # @!attribute [rw] maximum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     If the specified time or duration has passed, stop the study.
  # @!attribute [rw] min_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are fewer than this many COMPLETED trials, do not stop the
  #     study.
  # @!attribute [rw] max_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are more than this many trials, stop the study.
  # @!attribute [rw] max_num_trials_no_progress
  #   @return [::Google::Protobuf::Int32Value]
  #     If the objective value has not improved for this many consecutive
  #     trials, stop the study.
  #
  #     WARNING: Effective only for single-objective studies.
  # @!attribute [rw] max_duration_no_progress
  #   @return [::Google::Protobuf::Duration]
  #     If the objective value has not improved for this much time, stop the
  #     study.
  #
  #     WARNING: Effective only for single-objective studies.
  class StudyStoppingConfig
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The available search algorithms for the Study.
  module Algorithm
    # The default algorithm used by Vertex AI for [hyperparameter
    # tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
    # and [Vertex AI Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
    ALGORITHM_UNSPECIFIED = 0

    # Simple grid search within the feasible space. To use grid search,
    # all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
    GRID_SEARCH = 2

    # Simple random search within the feasible space.
    RANDOM_SEARCH = 3
  end

  # Describes the noise level of the repeated observations.
  #
  # "Noisy" means that the repeated observations with the same Trial parameters
  # may lead to different metric evaluations.
  module ObservationNoise
    # The default noise level chosen by Vertex AI.
    OBSERVATION_NOISE_UNSPECIFIED = 0

    # Vertex AI assumes that the objective function is (nearly)
    # perfectly reproducible, and will never repeat the same Trial
    # parameters.
    LOW = 1

    # Vertex AI will estimate the amount of noise in metric
    # evaluations, it may repeat the same Trial parameters more than once.
    HIGH = 2
  end

  # This indicates which measurement to use if/when the service automatically
  # selects the final measurement from previously reported intermediate
  # measurements. Choose this based on two considerations:
  #  A) Do you expect your measurements to monotonically improve?
  #     If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
  #     situation where your system can "over-train" and you expect the
  #     performance to get better for a while but then start declining,
  #     choose BEST_MEASUREMENT.
  #  B) Are your measurements significantly noisy and/or irreproducible?
  #     If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
  #     may be better to choose LAST_MEASUREMENT.
  #  If both or neither of (A) and (B) apply, it doesn't matter which
  #  selection type is chosen.
  module MeasurementSelectionType
    # Will be treated as LAST_MEASUREMENT.
    MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0

    # Use the last measurement reported.
    LAST_MEASUREMENT = 1

    # Use the best measurement reported.
    BEST_MEASUREMENT = 2
  end
end

#study_stopping_config::Google::Cloud::AIPlatform::V1::StudySpec::StudyStoppingConfig

Returns Conditions for automated stopping of a Study. Enable automated stopping by configuring at least one condition.

Returns:



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'proto_docs/google/cloud/aiplatform/v1/study.rb', line 250

class StudySpec
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Represents a metric to optimize.
  # @!attribute [rw] metric_id
  #   @return [::String]
  #     Required. The ID of the metric. Must not contain whitespaces and must be
  #     unique amongst all MetricSpecs.
  # @!attribute [rw] goal
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::GoalType]
  #     Required. The optimization goal of the metric.
  # @!attribute [rw] safety_config
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::MetricSpec::SafetyMetricConfig]
  #     Used for safe search. In the case, the metric will be a safety
  #     metric. You must provide a separate metric for objective metric.
  class MetricSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Used in safe optimization to specify threshold levels and risk tolerance.
    # @!attribute [rw] safety_threshold
    #   @return [::Float]
    #     Safety threshold (boundary value between safe and unsafe). NOTE that if
    #     you leave SafetyMetricConfig unset, a default value of 0 will be used.
    # @!attribute [rw] desired_min_safe_trials_fraction
    #   @return [::Float]
    #     Desired minimum fraction of safe trials (over total number of trials)
    #     that should be targeted by the algorithm at any time during the
    #     study (best effort). This should be between 0.0 and 1.0 and a value of
    #     0.0 means that there is no minimum and an algorithm proceeds without
    #     targeting any specific fraction. A value of 1.0 means that the
    #     algorithm attempts to only Suggest safe Trials.
    class SafetyMetricConfig
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # The available types of optimization goals.
    module GoalType
      # Goal Type will default to maximize.
      GOAL_TYPE_UNSPECIFIED = 0

      # Maximize the goal metric.
      MAXIMIZE = 1

      # Minimize the goal metric.
      MINIMIZE = 2
    end
  end

  # Represents a single parameter to optimize.
  # @!attribute [rw] double_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DoubleValueSpec]
  #     The value spec for a 'DOUBLE' parameter.
  # @!attribute [rw] integer_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::IntegerValueSpec]
  #     The value spec for an 'INTEGER' parameter.
  # @!attribute [rw] categorical_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::CategoricalValueSpec]
  #     The value spec for a 'CATEGORICAL' parameter.
  # @!attribute [rw] discrete_value_spec
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::DiscreteValueSpec]
  #     The value spec for a 'DISCRETE' parameter.
  # @!attribute [rw] parameter_id
  #   @return [::String]
  #     Required. The ID of the parameter. Must not contain whitespaces and must
  #     be unique amongst all ParameterSpecs.
  # @!attribute [rw] scale_type
  #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ScaleType]
  #     How the parameter should be scaled.
  #     Leave unset for `CATEGORICAL` parameters.
  # @!attribute [rw] conditional_parameter_specs
  #   @return [::Array<::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec>]
  #     A conditional parameter node is active if the parameter's value matches
  #     the conditional node's parent_value_condition.
  #
  #     If two items in conditional_parameter_specs have the same name, they
  #     must have disjoint parent_value_condition.
  class ParameterSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods

    # Value specification for a parameter in `DOUBLE` type.
    # @!attribute [rw] min_value
    #   @return [::Float]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Float]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DOUBLE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DoubleValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `INTEGER` type.
    # @!attribute [rw] min_value
    #   @return [::Integer]
    #     Required. Inclusive minimum value of the parameter.
    # @!attribute [rw] max_value
    #   @return [::Integer]
    #     Required. Inclusive maximum value of the parameter.
    # @!attribute [rw] default_value
    #   @return [::Integer]
    #     A default value for an `INTEGER` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class IntegerValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `CATEGORICAL` type.
    # @!attribute [rw] values
    #   @return [::Array<::String>]
    #     Required. The list of possible categories.
    # @!attribute [rw] default_value
    #   @return [::String]
    #     A default value for a `CATEGORICAL` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class CategoricalValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Value specification for a parameter in `DISCRETE` type.
    # @!attribute [rw] values
    #   @return [::Array<::Float>]
    #     Required. A list of possible values.
    #     The list should be in increasing order and at least 1e-10 apart.
    #     For instance, this parameter might have possible settings of 1.5, 2.5,
    #     and 4.0. This list should not contain more than 1,000 values.
    # @!attribute [rw] default_value
    #   @return [::Float]
    #     A default value for a `DISCRETE` parameter that is assumed to be a
    #     relatively good starting point.  Unset value signals that there is no
    #     offered starting point.  It automatically rounds to the
    #     nearest feasible discrete point.
    #
    #     Currently only supported by the Vertex AI Vizier service. Not supported
    #     by HyperparameterTuningJob or TrainingPipeline.
    class DiscreteValueSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods
    end

    # Represents a parameter spec with condition from its parent parameter.
    # @!attribute [rw] parent_discrete_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::DiscreteValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `DISCRETE` type.
    # @!attribute [rw] parent_int_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::IntValueCondition]
    #     The spec for matching values from a parent parameter of `INTEGER`
    #     type.
    # @!attribute [rw] parent_categorical_values
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec::ConditionalParameterSpec::CategoricalValueCondition]
    #     The spec for matching values from a parent parameter of
    #     `CATEGORICAL` type.
    # @!attribute [rw] parameter_spec
    #   @return [::Google::Cloud::AIPlatform::V1::StudySpec::ParameterSpec]
    #     Required. The spec for a conditional parameter.
    class ConditionalParameterSpec
      include ::Google::Protobuf::MessageExts
      extend ::Google::Protobuf::MessageExts::ClassMethods

      # Represents the spec to match discrete values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Float>]
      #     Required. Matches values of the parent parameter of 'DISCRETE' type.
      #     All values must exist in `discrete_value_spec` of parent parameter.
      #
      #     The Epsilon of the value matching is 1e-10.
      class DiscreteValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match integer values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::Integer>]
      #     Required. Matches values of the parent parameter of 'INTEGER' type.
      #     All values must lie in `integer_value_spec` of parent parameter.
      class IntValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end

      # Represents the spec to match categorical values from parent parameter.
      # @!attribute [rw] values
      #   @return [::Array<::String>]
      #     Required. Matches values of the parent parameter of 'CATEGORICAL'
      #     type. All values must exist in `categorical_value_spec` of parent
      #     parameter.
      class CategoricalValueCondition
        include ::Google::Protobuf::MessageExts
        extend ::Google::Protobuf::MessageExts::ClassMethods
      end
    end

    # The type of scaling that should be applied to this parameter.
    module ScaleType
      # By default, no scaling is applied.
      SCALE_TYPE_UNSPECIFIED = 0

      # Scales the feasible space to (0, 1) linearly.
      UNIT_LINEAR_SCALE = 1

      # Scales the feasible space logarithmically to (0, 1). The entire
      # feasible space must be strictly positive.
      UNIT_LOG_SCALE = 2

      # Scales the feasible space "reverse" logarithmically to (0, 1). The
      # result is that values close to the top of the feasible space are spread
      # out more than points near the bottom. The entire feasible space must be
      # strictly positive.
      UNIT_REVERSE_LOG_SCALE = 3
    end
  end

  # The decay curve automated stopping rule builds a Gaussian Process
  # Regressor to predict the final objective value of a Trial based on the
  # already completed Trials and the intermediate measurements of the current
  # Trial. Early stopping is requested for the current Trial if there is very
  # low probability to exceed the optimal value found so far.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}
  #     is used as the x-axis of each Trials Decay Curve. Otherwise,
  #     {::Google::Cloud::AIPlatform::V1::Measurement#step_count Measurement.step_count}
  #     will be used as the x-axis.
  class DecayCurveAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The median automated stopping rule stops a pending Trial if the Trial's
  # best objective_value is strictly below the median 'performance' of all
  # completed Trials reported up to the Trial's last measurement.
  # Currently, 'performance' refers to the running average of the objective
  # values reported by the Trial in each measurement.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     True if median automated stopping rule applies on
  #     {::Google::Cloud::AIPlatform::V1::Measurement#elapsed_duration Measurement.elapsed_duration}.
  #     It means that elapsed_duration field of latest measurement of current
  #     Trial is used to compute median objective value for each completed
  #     Trials.
  class MedianAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Configuration for ConvexAutomatedStoppingSpec.
  # When there are enough completed trials (configured by
  # min_measurement_count), for pending trials with enough measurements and
  # steps, the policy first computes an overestimate of the objective value at
  # max_num_steps according to the slope of the incomplete objective value
  # curve. No prediction can be made if the curve is completely flat. If the
  # overestimation is worse than the best objective value of the completed
  # trials, this pending trial will be early-stopped, but a last measurement
  # will be added to the pending trial with max_num_steps and predicted
  # objective value from the autoregression model.
  # @!attribute [rw] max_step_count
  #   @return [::Integer]
  #     Steps used in predicting the final objective for early stopped trials. In
  #     general, it's set to be the same as the defined steps in training /
  #     tuning. If not defined, it will learn it from the completed trials. When
  #     use_steps is false, this field is set to the maximum elapsed seconds.
  # @!attribute [rw] min_step_count
  #   @return [::Integer]
  #     Minimum number of steps for a trial to complete. Trials which do not have
  #     a measurement with step_count > min_step_count won't be considered for
  #     early stopping. It's ok to set it to 0, and a trial can be early stopped
  #     at any stage. By default, min_step_count is set to be one-tenth of the
  #     max_step_count.
  #     When use_elapsed_duration is true, this field is set to the minimum
  #     elapsed seconds.
  # @!attribute [rw] min_measurement_count
  #   @return [::Integer]
  #     The minimal number of measurements in a Trial.  Early-stopping checks
  #     will not trigger if less than min_measurement_count+1 completed trials or
  #     pending trials with less than min_measurement_count measurements. If not
  #     defined, the default value is 5.
  # @!attribute [rw] learning_rate_parameter_name
  #   @return [::String]
  #     The hyper-parameter name used in the tuning job that stands for learning
  #     rate. Leave it blank if learning rate is not in a parameter in tuning.
  #     The learning_rate is used to estimate the objective value of the ongoing
  #     trial.
  # @!attribute [rw] use_elapsed_duration
  #   @return [::Boolean]
  #     This bool determines whether or not the rule is applied based on
  #     elapsed_secs or steps. If use_elapsed_duration==false, the early stopping
  #     decision is made according to the predicted objective values according to
  #     the target steps. If use_elapsed_duration==true, elapsed_secs is used
  #     instead of steps. Also, in this case, the parameters max_num_steps and
  #     min_num_steps are overloaded to contain max_elapsed_seconds and
  #     min_elapsed_seconds.
  # @!attribute [rw] update_all_stopped_trials
  #   @return [::Boolean]
  #     ConvexAutomatedStoppingSpec by default only updates the trials that needs
  #     to be early stopped using a newly trained auto-regressive model. When
  #     this flag is set to True, all stopped trials from the beginning are
  #     potentially updated in terms of their `final_measurement`. Also, note
  #     that the training logic of autoregressive models is different in this
  #     case. Enabling this option has shown better results and this may be the
  #     default option in the future.
  class ConvexAutomatedStoppingSpec
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The configuration (stopping conditions) for automated stopping of a Study.
  # Conditions include trial budgets, time budgets, and convergence detection.
  # @!attribute [rw] should_stop_asap
  #   @return [::Google::Protobuf::BoolValue]
  #     If true, a Study enters STOPPING_ASAP whenever it would normally enters
  #     STOPPING state.
  #
  #     The bottom line is: set to true if you want to interrupt on-going
  #     evaluations of Trials as soon as the study stopping condition is met.
  #     (Please see Study.State documentation for the source of truth).
  # @!attribute [rw] minimum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     Each "stopping rule" in this proto specifies an "if" condition. Before
  #     Vizier would generate a new suggestion, it first checks each specified
  #     stopping rule, from top to bottom in this list.
  #     Note that the first few rules (e.g. minimum_runtime_constraint,
  #     min_num_trials) will prevent other stopping rules from being evaluated
  #     until they are met. For example, setting `min_num_trials=5` and
  #     `always_stop_after= 1 hour` means that the Study will ONLY stop after it
  #     has 5 COMPLETED trials, even if more than an hour has passed since its
  #     creation. It follows the first applicable rule (whose "if" condition is
  #     satisfied) to make a stopping decision. If none of the specified rules
  #     are applicable, then Vizier decides that the study should not stop.
  #     If Vizier decides that the study should stop, the study enters
  #     STOPPING state (or STOPPING_ASAP if should_stop_asap = true).
  #     IMPORTANT: The automatic study state transition happens precisely as
  #     described above; that is, deleting trials or updating StudyConfig NEVER
  #     automatically moves the study state back to ACTIVE. If you want to
  #     _resume_ a Study that was stopped, 1) change the stopping conditions if
  #     necessary, 2) activate the study, and then 3) ask for suggestions.
  #     If the specified time or duration has not passed, do not stop the
  #     study.
  # @!attribute [rw] maximum_runtime_constraint
  #   @return [::Google::Cloud::AIPlatform::V1::StudyTimeConstraint]
  #     If the specified time or duration has passed, stop the study.
  # @!attribute [rw] min_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are fewer than this many COMPLETED trials, do not stop the
  #     study.
  # @!attribute [rw] max_num_trials
  #   @return [::Google::Protobuf::Int32Value]
  #     If there are more than this many trials, stop the study.
  # @!attribute [rw] max_num_trials_no_progress
  #   @return [::Google::Protobuf::Int32Value]
  #     If the objective value has not improved for this many consecutive
  #     trials, stop the study.
  #
  #     WARNING: Effective only for single-objective studies.
  # @!attribute [rw] max_duration_no_progress
  #   @return [::Google::Protobuf::Duration]
  #     If the objective value has not improved for this much time, stop the
  #     study.
  #
  #     WARNING: Effective only for single-objective studies.
  class StudyStoppingConfig
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # The available search algorithms for the Study.
  module Algorithm
    # The default algorithm used by Vertex AI for [hyperparameter
    # tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
    # and [Vertex AI Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
    ALGORITHM_UNSPECIFIED = 0

    # Simple grid search within the feasible space. To use grid search,
    # all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
    GRID_SEARCH = 2

    # Simple random search within the feasible space.
    RANDOM_SEARCH = 3
  end

  # Describes the noise level of the repeated observations.
  #
  # "Noisy" means that the repeated observations with the same Trial parameters
  # may lead to different metric evaluations.
  module ObservationNoise
    # The default noise level chosen by Vertex AI.
    OBSERVATION_NOISE_UNSPECIFIED = 0

    # Vertex AI assumes that the objective function is (nearly)
    # perfectly reproducible, and will never repeat the same Trial
    # parameters.
    LOW = 1

    # Vertex AI will estimate the amount of noise in metric
    # evaluations, it may repeat the same Trial parameters more than once.
    HIGH = 2
  end

  # This indicates which measurement to use if/when the service automatically
  # selects the final measurement from previously reported intermediate
  # measurements. Choose this based on two considerations:
  #  A) Do you expect your measurements to monotonically improve?
  #     If so, choose LAST_MEASUREMENT. On the other hand, if you're in a
  #     situation where your system can "over-train" and you expect the
  #     performance to get better for a while but then start declining,
  #     choose BEST_MEASUREMENT.
  #  B) Are your measurements significantly noisy and/or irreproducible?
  #     If so, BEST_MEASUREMENT will tend to be over-optimistic, and it
  #     may be better to choose LAST_MEASUREMENT.
  #  If both or neither of (A) and (B) apply, it doesn't matter which
  #  selection type is chosen.
  module MeasurementSelectionType
    # Will be treated as LAST_MEASUREMENT.
    MEASUREMENT_SELECTION_TYPE_UNSPECIFIED = 0

    # Use the last measurement reported.
    LAST_MEASUREMENT = 1

    # Use the best measurement reported.
    BEST_MEASUREMENT = 2
  end
end