深度学习小白,记录自己代码学习以及debug过程的点点滴滴。
今天在做分类任务的时候,用到了贝叶斯参数优化,出现的错误如下:
Traceback (most recent call last):
File "D:\Anaconda3\lib\site-packages\bayes_opt\target_space.py", line 191, in probe
target = self._cache[_hashable(x)]
KeyError: (0.8012644357556348, 4.3034195274121, 3.969014184367836, 1.3385547879268833, 15.608997561924324, 28.909817257797137, 41.08071528029804)
During handling of the above exception, another exception occurred:
target = self.target_func(**params)
TypeError: cv_lgm() missing 1 required positional argument: 'berbose'
一直提示贝叶斯寻找最优参数时,‘verbose’参数没有实例化,我找了好久才发现,在进行定义黑盒函数时,
def cv_lgm(num_leaves,max_depth,lambda_l1,lambda_l2,bagging_fraction,bagging_freq,min_data_in_leaf,verbose):
其中在参数区域当时多加了一个verbose,后面无论给其赋值与否,都会产生错误,去掉就好了,两个错误就一起解决了。