計算輸入與目標之間的 hinge 損失。
\[\text{hinge}(y, y_{\text{pred}}) = \max(0, 1 - y \cdot y_{\text{pred}})\]
- 參數:
inputs (array) -- The predicted values.
targets (array) -- The target values. They should be -1 or 1.
reduction (str, optional) -- Specifies the reduction to apply to the output:
'none' | 'mean' | 'sum'. Default: 'none'.
- 回傳:
The computed hinge loss.
- 回傳型別:
array