gcp-ai-platform-notebookgoogle-ai-platformgoogle-cloud-ai-platform-pipelines

Change trialId in Google AI Platform hyperparameter tuning


I'm trying to follow this tutorial on hyperparameter tuning on AI Platform: https://cloud.google.com/blog/products/gcp/hyperparameter-tuning-on-google-cloud-platform-is-now-faster-and-smarter.

My configuration yaml file looks like this:

trainingInput:
  hyperparameters:
    goal: MINIMIZE
    hyperparameterMetricTag: loss
    maxTrials: 4
    maxParallelTrials: 2
    params:
      - parameterName: learning_rate
        type: DISCRETE
        discreteValues:
        - 0.0005
        - 0.001
        - 0.0015
        - 0.002

The expected output:

  "completedTrialCount": "4",
  "trials": [
    {
      "trialId": "3",
      "hyperparameters": {
        "learning_rate": "2e-03"
      },
      "finalMetric": {
        "trainingStep": "123456",
        "objectiveValue": 0.123456
      },
    },

Is there any way to customize the trialId instead the defaults numeric values (e.g. 1,2,3,4...)?


Solution

  • It is not possible to customize the trialId as it is dependent on the parameter maxTrials in your hyperparameter tuning config.

    maxTrials only accepts integers, so the assigned value to trialId will be a range from 1 to your defined maxTrials.

    Also as mentioned in the example in your post where maxTrials: 40 is set and it yields a json that shows trialId: 35 which is within the range of maxTrials.

    This indicates that 40 trials have been completed, and the best so far is trial 35, which achieved an objective of 1.079 with the hyperparameter values of nembeds=18 and nnsize=32.

    Example output:

    enter image description here