Vertex AI Hyperparameter Tuning with Conditional Logic

You developed a Python module by using Keras to train a regression model. You developed two model architectures, linear regression and deep neural network (DNN), within the same module. You are using the training_method argument to select one of the two methods, and you are using the learning_rate and num_hidden_layers arguments in the DNN. You plan to use Vertex AI's hypertuning service with a budget to perform 100 trials. You want to identify the model architecture and hyperparameter values that minimize training loss and maximize model performance. What should you do?

  1. Run one hypertuning job for 100 trials. Set num_hidden_layers as a conditional hyperparameter based on its parent hyperparameter training_method, and set learning_rate as a non-conditional hyperparameter. Source Reference Answer
  2. Run two separate hypertuning jobs, a linear regression job for 50 trials, and a DNN job for 50 trials. Compare their final performance on a common validation set, and select the set of hyperparameters with the least training loss.
  3. Run one hypertuning job with training_method as the hyperparameter for 50 trials. Select the architecture with the lowest training loss, and further hypertune it and its corresponding hyperparameters tor 50 trials.
  4. Run one hypertuning job for 100 trials. Set num_hidden_layers and learning_rate as conditional hyperparameters based on their parent hyperparameter training_method.

Community Votes

A
67%
D
33%

67% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

This question tests the ability to distinguish between shared and architecture-specific hyperparameters, specifically checking if you know that learning_rate applies to linear regression models trained via gradient descent, not just DNNs.

To efficiently identify the best model architecture and hyperparameters in Vertex AI, use a single hypertuning job with conditional hyperparameters. The community consensus confirms that num_hidden_layers must be conditional on the training method, while learning_rate is a shared parameter applicable to both linear regression and DNN models.

The most common error is selecting Option D, driven by the misconception that `learning_rate` is exclusive to Deep Neural Networks, whereas in Keras, linear regression models also utilize gradient descent optimizers requiring this parameter.

Community Discussion (9 comments)

kaneup 👍 1 Selected: D
this is D
River3000 👍 1
This should be D, as the question stated that 'linear regression and deep neural network (DNN), within the same module', This typically means that even the linear regression model is trained using gradient-based optimization (such as SGD or Adam), rather than using a closed-form solution. So, the phrase "within the same module" implies that the linear model also relies on gradient descent, and thus the learning_rate parameter is applicable for training both models—even though the DNN additionally uses the num_hidden_layers parameter for its architecture.
Ankit267 👍 1 Selected: A
A & D for obvious reasons. Why A ? DNN with 1 num_hidden_layer is equivalent to linear regression model therefore num_hidden_layer is conditional, though learning_rate can be hyperparametrized for both DNN( one hidden layer i.e. linear regression & >1 hidden layer i.e. DNN). Therefore A is the right answer
Pau1234 👍 2 Selected: A
Agree with Omi_04040. num_hidden_layers is only relevant to the DNN model and not the linear regression model, according to the documentation
Omi_04040 👍 2 Selected: A
Answer is A since 'learning rate' cannot be shared This question is a literal spinoff from this paragraph https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview#conditional_hyperparameters
rajshiv 👍 2 Selected: D
A is incorrect because both num_hidden_layers and learning_rate are hyperparameters specific to the DNN model. Since both hyperparameters need to be conditional on training_method being DNN, making only one of them conditional is not sufficient. The problem has two model architectures: linear regression and DNN. Depending on the model architecture, the hyperparameters change: 1) For DNN, the hyperparameters are num_hidden_layers and learning_rate while 2) For linear regression, these hyperparameters are not relevant. Hence I vote D.
lunalongo 👍 3
A is the best option because: Running one single job with conditional logics added to hyperparameters settings avoids unnecessary computing usage and comparison efforts. Only num_hidden_layers needs to be set as a conditional hyperparameter under training_method; no explicit conditional logic is needed for learning_rate -- the latter is intelligently ignored by Vertex AI when linear regression is the training_method. B, C and D are less suitable because B and C run 2 separate jobs; D runs only one job, but it's hyperparameter tuning strategy adds redundant processing, even if it's true that the learning_rate is irrelevant for linear regression methods. The underlying logics behind it: As a STRUCTURAL hyperparameter, num_hidden_layers is intrinsically tied to the DNN's architecture definition. As a TRAINING hyperparameter, learning_rate is linked to the training process, not directly tied to the architecture definition.
carolctech 👍 3 Selected: A
The best approach is A and here's why: The use of the 100 trials in a single job by using conditional hyperparameters maximizes budget efficiency. The number of hidden layers should be conditional, because it is relevant only for NON-LINEAR models like neural networks (which is DNN's case) and not for linear models -- where hidden layers don't exist. Learning rate is relevant for both models, unless the question stated that the regression model used a closed-form solution, not a gradient-based optimization method.
JDpmle2024 👍 1 Selected: D
This would allow you to first set the type of job, and only after that any other parameters. So first, select training_method. If training_method is DNN, then you specify the other parameters.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Option A is correct because it maximizes the 100-trial budget by running a single job that efficiently explores both architectures. It correctly configures num_hidden_layers as a conditional hyperparameter since this parameter is irrelevant for linear regression. Furthermore, it correctly identifies learning_rate as a non-conditional parameter because both the linear regression and DNN models, when implemented in Keras, rely on gradient-based optimizers that require a learning rate.

Why the Other Options Are Wrong

Option D is incorrect because it unnecessarily restricts learning_rate by making it conditional, implying it does not apply to linear regression, which is false in a Keras context. Options B and C are inefficient strategies; splitting the budget into separate jobs or running sequential sequential jobs reduces the effectiveness of the search compared to a unified tuning job that handles architecture selection via hyperparameters.

Community Comment Notes

Community members strongly support Option A, citing that learning_rate is intelligently ignored or shared depending on the context, but explicitly required for both model types in a gradient descent setup. One user linked to official Google Cloud documentation on conditional hyperparameters to validate that only architecture-specific parameters need conditional logic. There was some debate regarding whether linear regression uses a learning rate, but the consensus is that the phrase "within the same module" implies a shared gradient-based training loop.

Official Reference

Exam Strategy

When analyzing hyperparameter tuning scenarios, determine which parameters are global (like learning rate for gradient descent) versus those specific to certain model types (like hidden layers). Always prefer a single tuning job with conditional logic over multiple jobs to ensure the most efficient use of the trial budget.

Related Analysis

Practice All PMLE Questions

Access 65 questions with complete answers and detailed explanations.

View Full PMLE Practice Test →

← Back to PMLE Study Guide