mindsponge.metrics.BalancedMSE
- class mindsponge.metrics.BalancedMSE(first_break, last_break, num_bins, beta=0.99, reducer_flag=False)[source]
Balanced MSE error Compute Balanced MSE error between the prediction and the ground truth to solve unbalanced labels in regression task.
- 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 mindsponge.metrics import BalancedMSE >>> from mindspore import Tensor >>> net = BalancedMSE(0, 1, 20) >>> 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, 10)