Python 在使用AI平台超参数调优功能时,如何强制参数依赖性?
我有一个Python 在使用AI平台超参数调优功能时,如何强制参数依赖性?,python,google-cloud-platform,hyperparameters,gcp-ai-platform-training,Python,Google Cloud Platform,Hyperparameters,Gcp Ai Platform Training,我有一个scikit学习模型,我可以使用AI平台培训在GCP上进行培训。我还想使用AI平台培训进行超参数调整。这是可能的,只需传递带有参数及其范围的YAML: params: - parameterName: max_df type: DOUBLE minValue: 0.0 maxValue: 1.0 scaleType: UNIT_LINEAR_SCALE - parameterName: min_df type: DOUBLE minValue: 0 maxVa
scikit学习
模型,我可以使用AI平台培训
在GCP
上进行培训。我还想使用AI平台培训
进行超参数调整。这是可能的,只需传递带有参数及其范围的YAML:
params:
- parameterName: max_df
type: DOUBLE
minValue: 0.0
maxValue: 1.0
scaleType: UNIT_LINEAR_SCALE
- parameterName: min_df
type: DOUBLE
minValue: 0
maxValue: 1.
scaleType: UNIT_LINEAR_SCALE
这里的问题是,这两个参数之间存在某种依赖关系:
min\u df最后,我实现了我上面描述的想法,当给sciki learn的参数不正确时(比如当我们有df\u min>df\u max
时),返回0.0的度量(在我的测试中是accuray)
如下图所示,在超参数无效的情况下返回值0.0时,未报告应计项目:
我们还发现,代码只接受float或string作为度量的输入,如下所示,但我没有找到更多详细解释这一点的文档:
File "/root/.local/lib/python3.5/site-packages/hypertune/hypertune.py", line 62, in report_hyperparameter_tuning_metric
metric_value = float(metric_value)
TypeError: float() argument must be a string or a number, not 'NoneType'
我不确定这是100%正确,但似乎工作的预期
- parameterName: FT_norm
type: CATEGORICAL
categoricalValues: ['l1', 'l2', 'None']
File "/root/.local/lib/python3.5/site-packages/hypertune/hypertune.py", line 62, in report_hyperparameter_tuning_metric
metric_value = float(metric_value)
TypeError: float() argument must be a string or a number, not 'NoneType'