mindsponge.metrics.BinaryFocal
- class mindsponge.metrics.BinaryFocal(alpha=0.25, gamma=2.0, feed_in=False, not_focal=False)[source]
Focal error for Binary classifications. Compute the binary classes focal error between prediction and the ground truth target.
- Parameters
- Inputs:
prediction (Tensor) - Predict values, shape is
.target (Tensor) - Label values, shape is
.
- Outputs:
Tensor, shape is
.- Supported Platforms:
Ascend
GPU
Examples
>>> import numpy as np >>> from mindspore import Tensor >>> from mindsponge.metrics import BinaryFocal >>> net = BinaryFocal() >>> prediction = Tensor(np.random.randn(32, 10).astype(np.float32)) >>> target = Tensor(np.random.randn(32, 10).astype(np.float32)) >>> out = net(prediction, target) >>> print(out.shape) (32,)