请问您与2019年9月9日提出的关于hyperopt优化问题,结果不在space区间内,这一问题有解决答案了吗?我现在也遇到这样的问题,不知道问题出在哪里了。
在Hyperopt中,如果遇到结果不在预期的搜索空间范围内,可以通过以下方法解决:
如果问题仍然存在,建议您检查Hyperopt的相关文档以获取更多信息,或者在GitHub上查找相关问题。也可以考虑使用其他优化库,如Optuna,看看是否能解决问题。
rand_results = pd.DataFrame({'iteration': rand_trials.idxs_vals[0]['x'],
'loss': [x['loss'] for x in rand_trials.results],
'x': rand_trials.idxs_vals[1]['x']})
plt.figure(figsize = (8, 6))
plt.plot(rand_results['iteration'], rand_results['x'], 'bo', alpha = 0.5)
plt.xlabel('Iteration', size = 16); plt.ylabel('x value', size = 16)
plt.title('Random Sequence of Values', size = 22)
plt.hlines(minx, 0, 2000, linestyles = '--', colors = 'r')
rand_results = rand_results.sort_values('loss', ascending = True).reset_index()
plt.figure(figsize = (8, 6))
plt.hist(rand_results['x'], bins = 50, edgecolor = 'k');
plt.title('Histogram of Random Values')
plt.xlabel('Value of x')
plt.ylabel('Count');
print('Best Loss of {:.4f} occured at iteration {}'.format(rand_results['loss'][0], rand_results['iteration'][0]))
Best Loss of -394.7300 occured at iteration 1828