在 Google AI Platform 超参数调整中更改 trialId

问题描述

我正在尝试在 AI Platform 上学习超参数调整教程:https://cloud.google.com/blog/products/gcp/hyperparameter-tuning-on-google-cloud-platform-is-now-faster-and-smarter

我的配置 yaml 文件如下所示:

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

预期输出

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

有没有办法自定义 trialId 而不是认数值(例如 1,2,3,4...)?

解决方法

无法自定义 trialId,因为它取决于超参数调整配置中的参数 maxTrials

maxTrials 只接受整数,因此分配给 trialId 的值将是从 1 到您定义的 maxTrials 的范围。

同样如 example in your post 中所述,其中设置了 maxTrials: 40 并生成一个 json,显示 trialId: 35 位于 maxTrials 的范围内。

这表示已经完成了 40 次试验,是目前最好的 是试验 35,它达到了 1.079 的目标, nembeds=18 和 nnsize=32 的超参数值。

示例输出:

enter image description here