成功解决RuntimeWarning: invalid value encountered in double_scalars
成功解决RuntimeWarning: invalid value encountered in double_scalars
解决问题
print("Best: %.4f using %s" % (grid_result.best_score_, grid_result.best_params_))
print("XGBR_GSCV_Time score:", (-grid_result.best_score_)** 0.5)
RuntimeWarning: invalid value encountered in double_scalars
解决思路
运行时警告:在双刻度中遇到无效值
解决方法
grid_result.best_score_获得的该数值不符合计算要求!
T1、浮点数太大,需要精度限制,将小数点进行限制后,才可求得!
T2、根号下必须为正数,如以下修改
print("XGBR_GSCV_Time score:", (-round(-grid_result.best_score_, 3))** 0.5)
哈哈,大功告成!
赞 (0)