sklearn.metrics.mean_gamma_deviance?
sklearn.metrics.mean_gamma_deviance(y_true, y_pred, *, sample_weight=None)
平均伽瑪偏差回歸損失。
伽瑪偏差等于功率參數power=2的Tweedie偏差。它對于目標變量的定標是不變的,并且可以測量相對誤差。
在用戶指南中閱讀更多內容。
參數 | 說明 |
---|---|
y_true | array-like of shape (n_samples,) 真實目標值。要求y_true> 0。 |
y_pred | array-like of shape (n_samples,) 預測目標值。要求y_pred> 0。 |
sample_weight | array-like of shape (n_samples,), default=None 樣本權重。 |
返回值 | 說明 |
---|---|
loss | float 非負浮點值(最佳值為0.0)。 |
示例
>>> from sklearn.metrics import mean_gamma_deviance
>>> y_true = [2, 0.5, 1, 4]
>>> y_pred = [0.5, 0.5, 2., 2.]
>>> mean_gamma_deviance(y_true, y_pred)
1.0568...