Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Machine learning 在lightgbm中定义自定义损耗时出现分段错误_Machine Learning_Lightgbm_Boosting - Fatal编程技术网

Machine learning 在lightgbm中定义自定义损耗时出现分段错误

Machine learning 在lightgbm中定义自定义损耗时出现分段错误,machine-learning,lightgbm,boosting,Machine Learning,Lightgbm,Boosting,我在Lightgbm和boosting type=“goss”中尝试了以下回归任务的自定义损失,但我遇到了一个分段错误: def hm(y_true, y_pred): residual = (y_true - y_pred).astype("float") residual_abs = np.fabs(residual) grad = np.where(residual_abs<=300, np.copysign(1, -

我在Lightgbm和boosting type=“goss”中尝试了以下回归任务的自定义损失,但我遇到了一个分段错误:

def hm(y_true, y_pred):
    residual = (y_true - y_pred).astype("float")
    residual_abs = np.fabs(residual)
    grad = np.where(residual_abs<=300, 
                    np.copysign(1, -residual)* 0.5,
                    np.where(residual_abs>=900, 
                             np.copysign(1, -residual)* 1,
                             np.copysign(1, -residual)* 2))
    hess = np.ones(y_true.shape[0]) 
    return grad, hess
def-hm(y_-true,y_-pred):
残差=(y_真-y_pred).aType(“浮点”)
剩余值=np.fabs(剩余值)
梯度=np.式中(剩余值=900,
np.复制符号(1,-残差)*1,
np.复制符号(1,-残差)*2)
hess=np.one(y_true.shape[0])
返回梯度,赫斯

知道为什么会失败吗?Im使用goss和default hyperparameters

这不是一个分段错误,而是一个Python例外,当使用dart作为助推器类型时,会出现运行时错误。如果我使用goss,就会出现分段错误。对不起,操作中不清楚,我会纠正。