我正在尝试使用SciKit优化(skopt)实现GoogleCloudML引擎的超参数调优功能。我不确定如何始终转换ML引擎
scaleType
到
skopt.space.Real
的
prior
S.
制服足够直,圆木也一样
看
每种方法都有一个等价物,但我不完全确定实现是否一致。我也不确定如何实现ML引擎
UNIT_REVERSE_LOG_SCALE
如果
LOG_SCALE
与
skopt
的
log-uniform
优先。这个
原木均匀
对于远离的参数,分布的行为似乎不像人们希望的那样。
0
-例如,如果你想在
0.9
和
0.999
分布接近均匀(见下面的第一张图)。
代码和可视化使用
斯科普
S
原木均匀
以及下面的一些自定义转换。
#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt
import skopt
def sample_custom_log_uniform(min_val, max_val, n_samples):
sample = skopt.space.uniform(0, 1).rvs(n_samples)
return min_val + (10 ** sample - 1) / 9 *(max_val - min_val)
def sample_custom_reverse_log_uniform(min_val, max_val, n_samples):
sample = skopt.space.uniform(0, 1).rvs(n_samples)
return max_val - (10 ** sample - 1) / 9 *(max_val - min_val)
def sample(min_val, max_val, prior='log-uniform', n_samples=100000):
if prior == 'custom-log-uniform':
return sample_custom_log_uniform(min_val, max_val, n_samples)
elif prior == 'custom-reverse-log-uniform':
return sample_custom_reverse_log_uniform(min_val, max_val, n_samples)
else:
return skopt.space.Real(min_val, max_val, prior=prior).rvs(n_samples)
priors = (
'log-uniform', 'custom-log-uniform', 'custom-reverse-log-uniform')
fig, axes = plt.subplots(1, len(priors))
for (prior, ax) in zip(priors, axes):
ax.hist(sample(0.9, 0.999, prior))
ax.set_title(prior)
ax.set_yticklabels([])
plt.show()
我的问题是:
-
做
ml engine
实施
对数刻度
作为
原木均匀
或
custom-log-uniform
从上面还是别的什么?
-
做
ML引擎
实施
REVERSE_LOG_SCALE
作为
custom-reverse-log-uniform
在上面,还是其他什么?